203k views
0 votes
When a class contains a pointer to dynamically allocated memory, it is a good idea to equip the class with?

1 Answer

5 votes

No it is not a good idea, it shouldn’t be memberwise assignment NOT be used when an object contains a pointer to dynamically allocated memory. Class members are private by default, the following describes a class that would be a good candidate for conversion to a template class is a class which defines a new type of array.

User Lurker
by
7.1k points