I am confuse on what is the default constructor access modifier and what does this MSDN statemtn says
If the direct base class does not have an accessible parameterless instance constructor, a compile-time error occurs.
Because when i applied this with a test program it fails. I can make an object or class that is inheriting another class thogh there is no exteranal parameerless constructor defined.
class A
{
}
class B : A
{
}
class C
{
public void main()
{
B objB = new B();// as per MSDN here should be the compile time error.
}
}
[Source]
If the direct base class does not have an accessible parameterless instance constructor, a compile-time error occurs.
If a constructor is not defined for a class, the compiler will automatically generate a public default constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With