Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
231,198 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.