Comment créer une instance d'une classe enfant en C#?Instance de classe enfant?
public class Parent
{
public virtual void test()
{
Console.WriteLine("this is parent");
}
}
public class Child : Parent
{
public override void test()
{
Console.WriteLine("this is from child");
}
}
public static void main()
{
//Which one is right below?
Child ch = new Child();
Parent pa = new Parent();
ch = new Parent();
pa = new Child();
ch.test();
pa.test();
}
S'il vous plaît marquer le code-! – Foole
^^^ Cool, M. T Commenté! ;-) –