![]() |
Help in Vectors
I hava a base class and a derived class as below:
Code:
class basestd::vector<base*> pBase; And an instance for derived class as well derived* pDerived = new derived(); My query is : is it possible to add the derived class object pointer in to the base class vector i.e. pBase.push_back(pDerived); Kindly explain me on this. |
Re: Help in Vectors
Yes of course, that's the whole point of polymorphism.
|
| All times are GMT +5.5. The time now is 16:57. |