Answer:
Yes we can,
Using this code snippet we can understand that the virtual function(MyFunction) which is defined in the base class (hai) is called from the derived class (hello) which will return a value 1.
class hai
{
public virtual int MyFunction()
{
return 1;
}
}
class hello:hai
{
public int j()
{
return MyFunction();
}
}
Asked In: Many Interviews |
Alert Moderator