Search code examples
windows-runtimedefault-constructorclass-visibility

In WinRT, what is the visibility of the default .Ctor?


As an example (and the reason of my question), the class Windows.XAML.Media.Transform, as far as I can see from the WinMD info shown by ILDASM, has no defined constructor.

But if I try to derive from that class, on my C# project, compiler complains that non constructor can be found.

This seems to me that this could be a result of hidden visibility of the constructor.

A same effect can be achieved in C# declaring a private (or internal) Constructor, but it must be declared, otherwise a public constructor is created by the compiler, and the class is indeed derivable.

Any hint?


Solution

  • I think what's going on here is, that the class has explicitly declared an internal (default) constructor, no public constructor(s), so the developers can inherit from the class within the defining assembly. Everybody else, outside the assembly is prevented from beeing able to inherit from the class.