 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
student::student(const
student &s) :
|
|
checking(s) { //call copy ctor
|
|
school = new char[strlen(s.school) + 1];
|
|
strcpy(school, s.school);
|
|
cout <<"student copy
constructor called" <<endl;
|
|
}
|
|
|
student::~student()
{
|
|
delete[] school;
|
|
}
|
|
|
student
&student::operator=(const student &s) {
|
|
if (this != &s) {
|
|
static_cast<checking
&>(*this) = s; //call assign op of parent
|
delete[] school;
|
|
school = new char[strlen(s.school) +
1];
|
|
strcpy(school, s.school);
|
|
}
|
|
cout <<"student assignment op
called" <<endl;
|
|
return(*this);
|
|
}
|
|