DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Programming in C++
*****************************************************
#Post#: 77--------------------------------------------------
COPY CONSTRUCTOR
DIR By: gaurav
Date: May 21, 2019, 6:55 am
---------------------------------------------------------
[b]COPY CONSTRUCTOR[/b]
#include<iostream.h>
#include<conio.h>
class value
{
public: int a, b, c;
public: value(int x, int y)
{
a=x;
b=y;
}
value(const value& obj)
{
a=obj.a;
b=obj.b;
}
void display()
{
cout<<"VALUE => "<<a<<"\t"<<b<<"\n";
}
};
void main()
{
clrscr();
value A(1,2);
value B(A);
value C(B);
A.display();
B.display();
C.display();
getch();
}
*****************************************************
Page 1 of 1