Based on the question Using array of pointers as parameter to method I would like to ask what possible ways are available when someone want to create a structure of references to a class which is abstract. Afterwards it is filled with different Objects whose class is apparently derived from the same base. This structure must also be “transfered” inside functions of diverse classes being passed as argument.
I followed the strategy presented in the linked question (which of course is flawed) because I could not declare an array of Objects of an abstract class. However this is attainable through array of pointers. Can this be done with a vector without using pointers like:
vector<Square> allSquares;
? Do the references in that case hold their initial address wherever, if the vector itself is passed with reference (&allSquares)?