fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class base {
  6. int k;
  7. public:
  8. virtual void dummy() {cout << "base dummy" << endl;};
  9. };
  10.  
  11. class derived: public base {
  12. public:
  13. void dummy() {cout << "derived" << endl;};
  14. };
  15.  
  16. int main() {
  17. base* b1 = new base();
  18. base* b2 = new derived();
  19.  
  20. b1->dummy();
  21. b2->dummy();
  22. // your code goes here
  23. return 0;
  24. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
base dummy
derived