Hi
In my Code i am creating 2 object of my class and in assigentment operator
passing arugement by reference.
In output of my code i am getting to 2 Constructor call which right but there is 3 Distructor call which i am not able to understand why 3 Distructor call
#include<iostream.h>
class A
{
public:
A(){cout<<"Constructor of A"<<endl;}
~A(){cout<<"Distructor of ~A"<<endl;}
A operator =(A &a){cout<<"assigenment oprator"<<endl;}
};
int main()
{
A a1,a;
a=a1;
return 0;
}
out put:
Constructor of A
Constructor of A
assigenment oprator
Distructor of ~A
Distructor of ~A
Distructor of ~A