Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A {
- int n;
- protected:
- A(int i) : n(i) { }
- virtual int get() = 0;
- virtual void print() = 0;
- };
- int A::get() {
- return n;
- }
- class B : private A {
- protected:
- B(int i) : A(i) {}
- //insert code here
- }; // End of class B
- class C : public B {
- public:
- C(int i) : B(i) {}
- void print() {
- cout << get() ;
- }
- };
- int main(){
- int n;
- cin >> n;
- C *p = new C(n);
- p->print();
- return 0;
- }
Add Comment
Please, Sign In to add comment