#ifndef EXAMPLE25_STUDENTASSISTANT_H #define EXAMPLE25_STUDENTASSISTANT_H #include class StudentAssistant : public Assistant, public Student { public: StudentAssistant(std::string n, std::string f1, double g, std::string f2, std::string s) : Student(n, f1, g), Assistant(n, f2, s) {} //Student("S-"+n, f1, g), Assistant("A-"+n, f2, s) {} // When virtual derivation calls to constructors Person are ignored in classes Student and Assistant // calling constructor Person needs to be explicit here //StudentAssistant(std::string n, std::string f1, double g, std::string f2, std::string s) : //Person(n), Student(n, f1, g), Assistant(n, f2, s) {} //Person(n), Student("S-"+n, f1, g), Assistant("A-"+n, f2, s) {} virtual ~StudentAssistant() { } void print() const { // without virtual derivation it does not work //std::cout << "Student-Assistant: " << Person::name << " " << Student::faculty << " " // << avgGrade << " " << Assistant::faculty << " " << subject << std::endl; std::cout << "Student-Assistant: " << Student::name << " " << Student::faculty << " " << avgGrade << " " << Assistant::name << " " << Assistant::faculty << " " << subject << std::endl; } }; #endif //EXAMPLE25_STUDENTASSISTANT_H