【发布时间】:2014-11-03 23:26:26
【问题描述】:
往年考试2出现以下问题。
class SchoolBus { public: SchoolBus(int seats, int seatedStudents); bool addStudents(int students); bool removeStudents(int students); int getStudents() const; private: int seats; int seatedStudents; };2) 提供 SchoolBus 构造函数的实现。
SchoolBus(int seats, int seatedStudents) { this->seats = seats; this->seatedStudents = seatedStudents; }
我没有得到 #2。我知道这就是答案,但是您将如何在代码中编写并编译它?我想实际编译它,看看它是如何工作的。
【问题讨论】:
-
你试过编译代码吗?
标签: c++ class implementation