class Parent
{
public int GetNo()
{
return 1;
}
}
class Child : Parent
{
public Child()
{
}
public int GetNo()
{
Without virtual declared on the method, the base method will always be called because you declared your variable as Parent. If you can't append virtual to the base class, then you can only either declare the variable as Child, or cast it to Child and call your GetNo method:
Child p = new Child();
p.GetNo();
Or:
Parent p = new Child();
((Child)p).GetNo();