#include<iostream>
using namespace std;
class Person {
public: Person(int x) { cout << x << ":"; }
Person() {}
};
class Instructor : virtual public Person {
public: Instructor(int x) :Person(x) { }
};
class Student : virtual public Person {
public: Student(int x) :Person(x) { }
};
class TA : public Instructor, public Student {
public: TA(int x) :Student(x), Instructor(x) { cout << x * 3 ; }
};
int main() {
int no;
cin >> no;
TA ta(no);
return 0;
}
Thanks
Happy Computing !
using namespace std;
class Person {
public: Person(int x) { cout << x << ":"; }
Person() {}
};
class Instructor : virtual public Person {
public: Instructor(int x) :Person(x) { }
};
class Student : virtual public Person {
public: Student(int x) :Person(x) { }
};
class TA : public Instructor, public Student {
public: TA(int x) :Student(x), Instructor(x) { cout << x * 3 ; }
};
int main() {
int no;
cin >> no;
TA ta(no);
return 0;
}
Thanks
Happy Computing !
No comments:
Post a Comment