fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class thing1
  5. {
  6. public:
  7. virtual void thingTest()
  8. {
  9. cout << "I AM THING 1\n";
  10. }
  11. };
  12.  
  13. class thing2: public thing1
  14. {
  15. public:
  16. virtual void thingTest()
  17. {
  18. cout << "I AM THING 2\n";
  19. }
  20. };
  21.  
  22. void DoStuff( thing1& temp )
  23. {
  24. temp.thingTest();
  25. }
  26.  
  27.  
  28. int main()
  29. {
  30. thing2 thing;
  31. DoStuff( thing );
  32. }
  33.  
  34.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
I AM THING 2