[CSI] Overall Purpose of the Big Three - Clarification

Mikhail Nesterenko mikhail at cs.kent.edu
Mon Dec 12 10:10:48 EST 2016


> 
> Destructors are designed only for memory deallocation, but would it be safe
> to say that the big 3 are all used solely for objects with dynamic members?
> 
> For example:
> Copy constructors: Used for passing objects with dynamic members by value.
> Assignment Overloading: Used for assigning objects with dynamic members to
> other objects, or themselves.
> *also for stackability.
> Destructors: Used to deallocate dynamic members when the object goes out of
> scope.

The big three: destructor, copy constructor and overloaded assignment
are intended to be used for objects with dynamically allocated
members. The rule of beg three is that if one is defined, all three
need to be defined.

Thanks,
--
Mikhail 


More information about the cs13001 mailing list