Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Objects Inheritance Custom Exceptions

olu adesina
olu adesina
23,007 Points

In this example how can we create constructors with no parameters is this because of the base class?

Steven Parker

i checked the system..Exception Class on msdn and noticed that it has a constructor which doesn't take any parameters

is it only possible to add a constructor to the OutOfBoundsException that doesn't take any parameters because the base system.Exception Class has a constructor that also doesn't take any parameters

1 Answer

Steven Parker
Steven Parker
221,309 Points

:bell: Hi, I was alerted by your tag.

The base class does not limit what kind of constructors your class can have. It's actually quite common for a derived class constructor to take parameters when the base class does not.