How to call child object's overloading function in polymorphism?

Try: class Parent { public: virtual someFunc() { /* implementation A */ }; //^^^^^^^ }; Though technically not required. I always find it good style to also declare the derived function virtual: class Child : public Parent { public: virtual someFunc() { /* implementation B */ }; }; Unlike Java functions are not virtual by default.

Declare someFunc virtual. This will ensure that the implementation of the actual object is called, not the implementation depending on the pointer type. This will, however, add some overhead connected with the creation of the VTABLE and slower calling of the virtual function, but is essentially what polymorphism is.

There is no polymorphism here! None of your functions are virtual. If you want polymorphism, do this: class Parent { public: virtual someFunc() { /* implementation A */ }; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions