Constructors and Inheritance

后端 未结 10 1076
臣服心动
臣服心动 2020-12-16 15:18

Lets take an example in C#

public class Foo
{
    public Foo() { }
    public Foo(int j) { }
}

public class Bar : Foo
{

}

Now, All the pu

10条回答
  •  无人及你
    2020-12-16 15:37

    Really, its because the parent constructor wouldn't fully initialize the child object. A constructor is kind of a personal thing in that respect. That's why most languages don't inherit constructors.

提交回复
热议问题