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

后端 未结 7 1273
一个人的身影
一个人的身影 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:01

    If you have control of the code, the simplest way is to create a protected method in Parent class that only call base.Foo() and your child class Foo implementation call that method explicitly

    0 讨论(0)
提交回复
热议问题