In reply to bachan21:
Your understanding is correct.
Just, I want to add something in your example.
Even you have not declare method as virtual,but still it is virtual inside child class.
Because, if you declare virtual in base class it will reflect it’s all child class.
So, I suggest not declare method as virtual if you want to use only overwrite and not to use Polymorphism to avoid confusion.
base b1,b2;
derived d1;
initial begin
b1=new();
d1=new();
b2 = d1;
//Display of base
b1.display();
//Display of derived
d1.display();
//Display of derived
b2.display();
end
Thanks,
Harsh