#include <iostream>

using namespace std;

class A {
  public:
    int fun(int x) { 
        return x * x; 
    }
    
    int bar(int x) { 
        return x + x; 
    }
};

//class B : public A {
class B : private A {
  public:
    int pub(int x, int y) { 
        int d = bar(20);
        return fun(x, y); 
    }
  private:
    int fun(int x, int y) {   // hides A::fun()
        return A::fun(x) + y * y;
    }
};

int main() {
    A a;
    B b;
    
    cout << "a.fun(3)    = " << a.fun(3) << endl;
    cout << "b.pub(3, 4) = " << b.pub(3, 4) << endl;
//    cout << "b.fun(3, 4) = " << b.fun(3, 4) << endl;  // private
//    cout << "b.fun(3)    = " << b.fun(3) << endl;     // hidden
//    cout << "b.bar(3)    = " << b.bar(3) << endl;     // how B inherits from A?
}
