Tuesday, May 15, 2007

Copy constructor Basic

This article will describe the Basics of Copy Constructor.


When u create any object and want to initialize that object on same time with another same type object this time your normal constructor is not called although a special type of Copy Constructor is called by compiler and this special constructor is Copy Constructor.


MyObject A;
MyObject B;
B=A; //this time normal constructor will call

MyObject A;
MyObject B = A; //this time Copy constructor will call

In next Atricle i will explain what is the need of Copy Constructor.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home