destructor

This commit is contained in:
Jidong Xiao
2025-04-11 04:33:10 -04:00
committed by JamesFlare1212
parent 7f7b936341
commit 34f972e3f4
2 changed files with 69 additions and 0 deletions

View File

@@ -21,6 +21,12 @@ public:
class Student : public Human {
public:
/* in C++, when a derived class inherits from a base class,
* the base class's constructor must be called to initialize its members.
* This is because the base class may contain private or protected members
* that are not directly accessible by the derived class.
* Therefore, the derived class relies on the base class's constructor to properly initialize these members. */
Student(std::string n, int a, int s) : Human(n, a, s) {}
};