April 2017
Beginner to intermediate
394 pages
9h 16m
English
As we said, and as you saw in the code examples above, we didn't use copy constructors in any of the component Clone methods. We also didn't use them in the Clone method of M5Object. By default, classes have copy constructors and assignment operators generated by the compiler. In the Shape example above, we used the compiler generated copy constructor in our Clone methods.
However, in the Mach5 Engine there is an important choice to consider. What should the copy constructor do about the m_id variable value? Remember that this ID is supposed to be unique for every object and every component. However, if we use the compiler generated copy constructor, each variable, including m_id, will be copied by value. This ...
Read now
Unlock full access