, , . . , , . , :
parentType(int foo) {...}
parentType(string foo) {...}
:
derivedType(string foo) {...}
new derivedType(7);? , new baseType(7);, "" , , derivedType, derivedType . ( ), .
By the way, there are several related problems with protected constructors. In some .net languages, including at least the current version of C #, if not an abstract type Foodefines a protected constructor, this constructor can only be used to instantiate derived types. In other languages, including the current vb.net, for code inside a derived type, you can call the protected constructor of the base type to create a new instance of the base type.
source
share