blob: a79d1fdbba649ef819004ed9cb42bf47d4a55c71 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "Student.h"
Student::Student(const char* name, int age, size_t fn) : Person(name, age)
{
setFn(fn);
}
size_t Student::getFn() const
{
return fn;
}
void Student::setFn(size_t fn)
{
if (fn < 100)
fn = 100;
this->fn = fn;
}
// The compiler will make:
//Student(const Student& other) : Person(other), fn(other.fn), grade(other.grade) OK!!!
//{}
//Student& operator=(const Student& other) OK!!!!
//{
// if (this != &other)
// {
// Person::operator=(other); //handles the deletion and copying of the base class
// fn = other.fn;
// }
// return *this;
//}
|