Code:
#include<iostream.h>
#include<conio.h>
#include<string.h>
class student
{ char *name;
int age;
int *regno;
int *address;
int cgp;
private:
student()
{
name=new char[10];
age=0;
regno=new int(0);
address=new int(0);
cgp=0;
}
student( char* nm, int ag, int* rn, int *ad, int cg)
{
strcpy(name,nm);
age=ag;
regno=rn;
address=ad;
cgp=cg;
}
~student()
{
delete name;
delete regno;
delete address;
}
student(const student &k)
{
name=k.name;
age=k.age;
regno=k.regno;
address=k.address;
cgp=k.cgp;
}
void setname()
{
cin>>name;
}
char* getname()
{
return name;
}
void print()
{
cout<<name<<endl;
cout<<age<<endl;
cout<<regno<<endl;
cout<<cgp<<endl;
}
};
int main()
{
clrscr();
student a;
student b;
a.setname();
a.getname();
a.print();
b.print();
getch();
return 0;
}
Student::student() is not accesible
student::~student() is not accessible
student::setname(), getname() not accessible