#include<iostream.h>
#include<conio.h>
class A
{
int a;
public:
A() //default Constructor
{}
A(int x) //Parameterized Constructor
{
a=x;
}
A(const A &x) //Copy Constructor
{
a=x.a;
}
void display()
{
cout<<"A::"<<a<<endl;
}
};
void main()
{
A obj1(10);
A obj2(obj1);
A obj3=obj1;
obj1.display();
obj2.display();
obj3.display();
getche();
}
No comments:
Post a Comment