#include <iostream>
#include <string>

class Base {
public:
  virtual void foo(int) { std::cout << "INT" << std::endl; }
};

class Derived : public Base {
public:
  virtual void foo(int) { std::cout << "INT" << std::endl; }
  virtual void foo(double) { std::cout << "DOUBLE" << std::endl; }
  virtual void foo(std::string) { std::cout << "STRING" << std::endl; }
};

int main() {
  Base b;
  Derived d;

  Base& bd = d;

  bd.foo(5);

  //  bd.foo(std::string("a"));

  Derived& d2 = d;

  d2.foo(5);

  d2.foo(std::string("a"));
}

