Copy Constructor: Firstly, what is constructor? A constructor is a method define in a class by same name as of class. The work of constructor is to initialize the class members.Constructor is defined publicaly or privately. A Constructor never return any value,so it will never have any return type. A constructor without an argument is called default constructor. A constructor with an argument is known as parameterised constructor
example: class example
{
int a,b; //data member
public:
example() //Default Constructor
{
a=10;
b=10;
}
example(int x, int y) //parameterised Constructor
{
a=x;
b=y;
}
};
this pointer: Member function of every class object have a special kind of pointer known as this pointer, which points to the object itself. When we cal a member function it comes into existence with the value of this set to the address of object it is pointing. Using a this pointer any member function can find out the the address of the object which it is pointing. Using this pointer a member function can also access the data of the object.
example: