next up previous contents
Next: Passing structs as parameters Up: Tips and Tricks Previous: Pointers   Contents

Copy constructor and assignment operator relationship?

Since these two methods are essentially the same (aside from how they are invoked) you can simplify the copy constructor declaration by initializing the data members and then calling the assignment operator directly. This will simplify adding new member variables and eliminate the chance of the two methods getting out of synchronization.


42#42



Falko Kuester 2001-08-24