Answer the question
In order to leave comments, you need to log in
How to make std::array distinguish between parent and child?
Let's say there is a class Example and a successor ExampleDerived. How, when placing both of them in std::array, how to make the child call exactly its versions of the methods, and not the parent ones? Can this only be done manually? Or dancing with virtual?
Answer the question
In order to leave comments, you need to log in
Dancing with virtual. That's why they were invented.
There is also the question of how exactly you place objects in a std::array and what kind of objects they are. In your case, you need to put either references or pointers (smart) in the array, otherwise you risk catching problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question