错误是:
d_start
是受保护成员CourseActivity
duration
是受保护成员 是受保护成员CourseActivity
location
是受保护成员CourseActivity
class CourseActivity{
protected:
StartTime* d_start;
double duration;
std::string location;
public:
CourseActivity() = default;
CourseActivity(const StartTime* _start, double _duration,
const std::string_location);
void reschedule(StartTime* _newStart);
void print() const;
};
class Lecture: public CourseActivity{
std::string topic;
bool deflt = false; //indicate which constructor was used.
//false = 1st. true = 2nd
public:
Lecture(const StartTime* _start, double _duration,
const std::string location, const std::string& _topic);
Lecture(const CourseActivity& _oActivity, const std::string& topic );
void print();
};
// ERROR
Lecture::Lecture(const CourseActivity& _oActivity, const std::string& _topic)
: CourseActivity(_oActivity.d_start,_oActivity.duration,_oActivity.location){
topic = _topic;
deflt = true;
}
// ERROR