#include <iostream>
#include <cstring>
using namespace std;
class Student
{
private:
char* name;
string id;
int score;
public:
Student(char*name1,string id1,int score1);
Student(const Student &p);
void print();
~Student();
};
Student::Student(char*name1,string id1,int score1):name(name1),id(id1),score(score1)
{
name = new char[strlen(name1) + 1];
strcpy(name, name1);
id=id1;
score=score1;
}
Student::Student(const Student &p)
{
name = new char[strlen(p.name) + 1];
strcpy(name, p.name);
id=p.id;
score=p.score;
}
Student::~Student()
{
delete[]name;
}
void Student::print()
{
cout<<name<<endl<<id<<endl<<score<<endl;
}
int main()
{
Student s1("limingcan","1",100);
s1.print();
Student s2=s1;
s2.print();
}