1.BASIC PROGRAMS FOR C++ CONCEPTS COPY CONSTRUCTOR
AIM:
To write a program for implementing Copy Constructor.

ALGORITHM:
STEP 1: Start the program.
STEP 2: Declare the variable and function.
STEP 3: Call the function and insert the value of X.
STEP 4: Insert the new value as test new and copy old value of x.
STEP 5: Display the original value   that is old value then copy the new value.
STEP 6: Stop the program execution,
 PROGRAM:
#include<iostream.h>
#include<conio.h>
class test
{
int x;
public:
test();
test(int val)
{
x=val;
}
test(test &obj)
{
x=obj.x;
}
void show()
{
cout<<x;
}
};
void main()
{
int val; clrscr();
cout<<"enter some number:"<<endl;
cin>>val;
test Old(val);
test New(Old);
cout<<"\n The original value is:";
Old.show();
cout<<"\n The New copied value is:";
New.show();
cout<<endl;
getch();
}
OUTPUT:

Enter some number: 500
The original value is: 500
The New copied value is:500