Let say I have this example:
class A : SomeAbstractClassWithProperties
{
public A(string id, int size)
{
this.Name = "Name1";
this.Something = new SomethingElse(id, size);
}
//...some stuff
}
class B : A
{
public B(string id, int size)
{
this.Name = "Name2";
this.Something = new SomethingElse(id, size);
}
}
Ok this is not gonna work:
Inconsistent accessibility: base class A is less accessible than class 'B'
'A' does not contain a constructor that takes 0 arguments
But as we see the constructor of Class A and Class B are almost the same. Just this.Name is different. How could I rewrite class B? Any suggestions? Thank you
Please update your code
The case is you B constructor tries to call A() default constructor which desn’t exists.