Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

class Base {};
class Derived: public Base {};

void test(Base& b) { std::cout << "BASE" << std::endl; }
void test(Derived& d) { std::cout << "DERIVED" << std::endl; }

int main() {
  Base* b = new Derived();
  test(*b);
}
gcc version 4.6.3