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