I have an assignment that doesn't allow me to use the vector class. I have a base class called Shape and different derived class such as Rectangle and Circle and i have to create my own vector class that has a dynamic array which can hold all these different shapes. I have used the following method that seems to work well
int **shape=new int*[capacity];
My problem comes with the "add_shape" function. I know how to add a shape individually using for example:
shape[0]=new Rectangle();
shape[1]=new Circle();
But how would one go about creating a universal function for adding a shape that could either be a rectangle or circle for instance.
MyVector<std::unique_ptr<BaseClass>>?