Shallow Copy:
Default copy constructor of compiler copies all the member variables from source to destination object. This is called shallow copy constructor.
Example:
#include<string.h> #include<iostream.h> class C { public: int var1; }; void main(int argc, char *argv[]) { C c1; c1.var1 = 1; C c2(c1); cout << "value of c2.val " << c2.val; }
About our authors: Team EQA
You have viewed 1 page out of 62. Your C++ learning is 0.00% complete. Login to check your learning progress.