How to make std::array to distinguish between parent and heir?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
52 views
Suppose we have a class Example and heir ExampleDerived. How when you place both of them in std::array to make a call the heir of his versions of the methods, and not the parent? This can only be done manual custom? Or dancing with the virtual?
by | 52 views

2 Answers

0 like 0 dislike
Dancing with virtual. For they invented.
There is still the question of how exactly you place the objects in a std::array and which are objects. In your case you need to place in the array or references or pointers (smart), otherwise you risk to get problems.
by
0 like 0 dislike
This can be implemented using CRTP
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
4 answers
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
asked Jun 7, 2019 by phpcoder81
0 like 0 dislike
2 answers
asked Jun 8, 2019 by phpcoder81
110,608 questions
257,187 answers
0 comments
40,796 users