llamar al método de clase secundaria desde la clase base C #
¿Es posible llamar al método de clase secundaria desde la referencia de clase base? Por favor recomiende...
El ejemplo de código se da a continuación:
public class Parent
{
public string Property1 { get; set; }
}
public class Child1:Parent
{
public string Child1Property { get; set; }
}
public class Child2 : Parent
{
public string Child2Property { get; set; }
}
public class Program
{
public void callMe()
{
Parent p1 = new Child1();
Parent p2 = new Child2();
//here p1 & p2 have access to only base class member.
//Is it possible to call child class memeber from the base class reference based on the child class object it is referring to?
//for example...is it possible to call as below:
//p1.Child1Property = "hi";
//p2.Child1Property = "hello";
}
}