Inheritance of constructors in C#

This is a serious problem with the C# langauage.

Given the following two classes:

class First
    First(string message)

class Second


The following will not compile:

Second = new Second(“Test”);

Now I know if I add the following to Second

    Second(string message)  : base(message)

This is not much code for a simple constructor, but what about classes with multiple constructors like exceptions? That makes them more difficult to define than necessary.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s