You're no longer dealing with an array of "Shapes" objects, you're dealing with an array of Shapes pointers (Shapes*). So the places where you pass in a "Shapes sArr[]" is misleading, because you're currently passing in a single object, not an array.
Make the signature of the function be, for example,
altMenu(Shapes** sArr, int size)
or equivalently,
altMenu(Shapes* sArr[], int size)
Then, you do
1 2 3 4
|
for (int i = 0; i < size; i++)
{
sArr[i]->print(i);
}
| |
And on line 61, don't dereference shapesArr.
Also, get rid of line 190, you never use a temp object so why have it?
(also unrelated, is there a better way to pause instead of utilizing system("pause")?) |
There's a thread that discusses a bunch of stuff about pausing here:
http://www.cplusplus.com/forum/beginner/1988/
I suggest reading it. One solution would be to run the program inside of cmd instead of through visual studio, or, if possible, configure visual studio to pause automatically, without having to use system.