Hello Friends!!!!! Today I am going to learn how to use all three constructor in a single program.In this program we make three constructor and use them
So Let's Start=>
//Name : Mayank Sharma //
//Roll No : 1101026 //
//CSE(4th Sem)
PROGRAM IN WHICH WE USE ALL THREE CONSTRUCTOR
#include
#include
class demo
{
int x,y;
public:
demo()
{
x=0;
y=0;
}
demo(int a, int b)
{
x=a;
y=b;
}
demo(demo &c)
{
x=c.x;
y=c.y;
}
void display()
{
cout<<"value of x"<
void main()
{
clrscr();
demo d1,d2(10,15);
d1.display();
d2.display();
demo d3=d2;
d3.display();
getch();
}
I think this post will help you.I think this post will help you.
Thanks!!!
If any query about this post then put your comment in comment box below..






0 comments:
Post a Comment