Sunday, June 10, 2007

copy all parts of an object

copying functions = copy constructor, copy assignment

when you add any data member or something else, make sure that all the copying functions are properly modified for this.

in a good design only copy constructor and copy assignment are the only functiosn copying objects

make sure derived classes copy all the elements of their base class also.

why shud we not call one copying funtion from the other ?


things to remember:
copying functions should be sure to copy all of an objects data members and all of its base class parts

dont try to implement one of the copying functions in terms of the other. insread put common functionality in a third funtion that both call

No comments: