Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
class Base
{
    public new virtual void Show()
    {
        Console.WriteLine("Base ");
    }
}
class Child1 : Base
{
    public override void Show()
    {
        Console.WriteLine("Drived1 ");
    }
}
class Child2 : Child1
{
    public virtual void Show()
    {
        Console.WriteLine("Drived2 ");
    }
}
class Child3 : Child1
{
    public new void Show()
    {
        Console.WriteLine("Drived3 ");
    }
}
Posted

1 solution

1. new virtual - this combination does not make sense (see below).
2. override - you are overriding (introducing new implementation of) some base virtual or abstract method
3. virtual - this method can be overidden in derived (child) class
5. new - you are introdicing new implementation of method, which was not marked with virtual keyword
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900