```
class TypeA {}
class TypeB : TypeA {}
class TypeC : TypeB {}
class ClassA {
void ClassA(TypeA typeA) {}
}
class ClassB : ClassA {
void ClassB(TypeB typeB) {}
}
class ClassC : ClassB {
void ClassC(TypeC typeC) {
TypeC typeC2 = (TypeC)typeA;
}
}
ClassC classC = new ClassC(new TypeC());
```
```
TypeC typeC2 = (TypeC)typeA; // yes the ident is typeA which is clearly not defined in that ctor, i explain this later.
```
For the line above, an error is thrown that this is "unsafe down-casting", which is not true, cast is being done between the same exact types from static point of view. If we went with the idea that Enscript does not support constructor overloading, then it means that the above code should not compile. At first, I thought that only the top level "base" constructor (TypeA) is put into consideration, then I realised that it's not the case, i.e.,
```
ClassC classC = new ClassC(new TypeA());
```
does not compile, so okay, it expects 'TypeC' as declared in the constructor of 'ClassC', but then the signature of ClassC's constructor is actually the signature of ClassA's, if you look at the code, even though the parameter 1 is 'TypeC typeC', the compiler sees it as 'TypeA typeA' (yes even the identifier).
```
class ClassC : ClassB {
void ClassC(TypeC typeC) {
TypeC typeC2 = (TypeC)typeA;
}
}
```
'typeA' is clearly undefined in this constructor and 'typeC' is defined being 'TypeC', however, that's not the case, the signature of this ctor according to the compiler is actually
```
void ClassC(TypeA typeA);
```
You can look at this in many different ways, in any case this is clearly a bug, bug as in, Enscript requires exact ctors in all the derived classes but when attempted otherwise, no error is thrown.