/* CSE 333 lecture 15: static dispatch and inheritance */
/* HP */

// What is the output from this program?

#include <iostream>
using namespace std;

class A {
public:
  void p() { cout << "ap" << endl; }
  void q() { cout << "aq" << endl; }
};

class B : public A {
public:
  void p() { cout << "bp" << endl; }
};

int main() {
  A* x = new B();
  x->p();
  x->q();

  B* y = new B();
  y->p();
  y->q();

  return 0;
}