Code Issues – Base type constructors are not implemented

April 26th, 2011

The Base type constructors are not implementedcode issue is an alternative code issue to the “Can implement base type constructors“. The different between these two is in their type – one is an error and another one is a hint. When the current type doesn’t implement non-default constructors from a base type the “Base type constructors are not implemented” error is shown.

Consider the following example, where you can see this code issue:

Here we have two classes – Person and Customer. The Person class has a single constructor that takes one parameter of type string. The Customer class, on the other hand, doesn’t have any constructors, and the compiler will generate the default one – a public constructor with no parameters. This default constructor will call the default constructor of the base class, which simply doesn’t exist, and the source code won’t compile in this case. Thus, we have to implement at least missing constructors from the base class – the code issue is shown in this case: