I have three classes. First of them is abstract, and it is inherited by child class, which is again inherited. How to call method from the third class in abstract one?
Example code:
public abstract class DoSth
{
public void DoSomething()
{
Console.WriteLine("I'm doing something");
this.DoSomethingBigger();
}
protected abstract void DoSomethingBigger();
}
public class Writer : DoSth
{
protected override void DoSomethingBigger()
{
Console.WriteLine("I'm writting");
}
}
public class BookWriter : Writer
{
protected new void DoSomethingBigger()
{
Console.WriteLine("I'm writting a book");
}
}
How to call DoSomethingBigger()
from a BookWriter
class?
When I make an instance of a BookWriter
and I call DoSomething()
my output is
I'm doing something
I'm writting
but I want
I'm doing something
I'm writting a book