The copy constructor is used to copy an object to a newly created object. This is used during
initialization and not during ordinary assignment. The copy constructor is invoked whenever a new
object is created and initialized to an existing object of the same kind.
In other words, the assignment operator handles assigning one object to another of the same class.
If a statement creates a new object it is using initialization. If it alters the value of an existing object
it is assignment.
initialization and not during ordinary assignment. The copy constructor is invoked whenever a new
object is created and initialized to an existing object of the same kind.
In other words, the assignment operator handles assigning one object to another of the same class.
If a statement creates a new object it is using initialization. If it alters the value of an existing object
it is assignment.
Comments
Post a Comment
https://gengwg.blogspot.com/