• Source
    1. #include<iostream>
    2. #include<string>
    3. using namespace std;
    4. class Person
    5. {
    6. protected:
    7. int age;
    8. string name;
    9. };
    10. class Hobbies
    11. {
    12. protected:
    13. string hobby;
    14. };
    15. class Student: public Person, public Hobbies
    16. {
    17. public:
    18. Student(int _age, string _name, string _hobby)
    19. {
    20. age = _age;
    21. name = _name;
    22. hobby = _hobby;
    23. }
    24. void show()
    25. {
    26. cout << "Ten: " << name << endl;
    27. cout << "Tuoi: " << age << endl;
    28. cout << "Hobbies: " << hobby << endl;
    29. }
    30. };
    31. int main()
    32. {
    33. Student a = Student(19, "Nguyen Dinh Tai", "Anime, Code, Movies");
    34. a.show();
    35. return 0;
    36. }