-2
virtual void MyMethod()
{
    DoOneThing();
}

I want to implement DoAnotherThing() along with DoOneThing() here-

override void MyMethod()
{
    //DoOneThing() also.
    DoAnotherThing();
}

Is it possible at all?

s.k.paul
  • 7,099
  • 28
  • 93
  • 168

1 Answers1

1

Here small example

abstract class Foo
{
    public virtual void MyMethod()
    {
        Console.WriteLine("DoOneThing");
    }
}

class MegaFoo : Foo
{
    public override void MyMethod()
    {
        base.MyMethod(); // call Foo.MyMethod
        Console.WriteLine("DoAnotherThing");
    }
}
tym32167
  • 4,741
  • 2
  • 28
  • 32