Copy Constructor
Song(Song const&);It is needed if you want to initialize an object to take the value of another one:
Song a; Song b = a; // Calls copy constructorAssignment Operator
void operator=(const Song&);It is needed for assigning a value to an already existing instance:
Song a; Song b; b = a; // Calls assignment operatorNote that the standard return value for an assignment operator is a reference:
Song& operator=(const Song&);
No comments:
Post a Comment