I don't quite understand the modifiernew
in C#: In which way is the following code different depending on the presence of the new
modifier?
class A
{
public void F() { Console.WriteLine("A::F()"); }
}
class B : A
{
public new void F() { Console.WriteLine("B::F()"); }
public static void Main()
{
A a = new B();
B b = new B();
A trueA = new A();
a.F();
b.F();
trueA.F();
Console.ReadLine();
}
}
Is there any equivalent or similar thing in C++?