When base class pointer points to a derived class pointer and an inherited non-virtual function which is refined in derived class, the definition present in base class would execute. This happens because non-virtual functions are statically bind. So
Cheers
- Either declare only those functions non-virtual which will remain invariant in derived classes
- Or use virtual functions or it's alternatives at defines here.
Cheers
No comments:
Post a Comment