virtual methods

后端 未结 3 407
天命终不由人
天命终不由人 2021-01-28 12:01

If I have a class named \"Parent\" for example. he has a method named \"Print\". the class \"Kid\" is derived, it has a method named

3条回答
  •  温柔的废话
    2021-01-28 12:44

    You are not overriding the method in your inheriting class - you are shadowing it.

    Instead of:

    public new void Print();
    

    Use:

    public override void Print();
    

提交回复
热议问题