C#: Any way to skip over one of the base calls in polymorphism?

后端 未结 7 1285
一个人的身影
一个人的身影 2021-01-17 16:34
class GrandParent
{
    public virtual void Foo() { ... }
}

class Parent : GrandParent
{
    public override void Foo()
    {
       base.Foo();

       //Do additi         


        
7条回答
  •  太阳男子
    2021-01-17 17:00

    I think there is something wrong with your design here. Essentially, you want to "break" the rules of polymorphism. You are saying Child should derive from Parent but want to conveniently skip the implementation in it's parent.

    Re-think your design.

提交回复
热议问题