Download presentation
Presentation is loading. Please wait.
Published byPolly Hamilton Modified over 9 years ago
1
CS212: Object Oriented Analysis and Design Lecture 10: Copy constructor-II
2
Copy copy: revisited Main Constructor Copy Constructorh f(): global functionx=h
3
What happens if we don’t use it? Compiler creates one for you in the case of simple structures The default primitive behaviour: a bit-copy. C++ compiler will still automatically create a copy-constructor if you don’t make one The process the compiler goes through to synthesize a copy- constructor is called member-wise initialization.
4
Issues with pointers 50x8975 5 A B {B=A;} Initial object Duplicate object
5
Deep vs Shallow copy Copy constructor is called only for initializations For assignment ? Operator overload ??
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.