C# How to call a derived methods?

69 Views Asked by At

I have a situation where I want to call only one method and have all the methods its derived from called also.

public class Base
{
    public virtual void Method()
    {
        // Do something
    }
}

public class Derived1 : Base
{
    public override void Method()
    {
        base.Method();
        // Do something
    }
}

public class Derived2 : Derived1
{
    public override void Method()
    {
        base.Method();
        // Do something
    }
}

I want to only call Derived2.Method() and have all the Methods() called that it derives from The issue with the way I currently have it set up is that Derived1.Method() never gets called.

Is there a way to make the called method call all the previous instances of it in a derived class?

0

There are 0 best solutions below