fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. public:
  7. A() {
  8. };
  9. virtual void func()=0;
  10. };
  11.  
  12. void A::func() {
  13. cout<<"A::func"<<endl;
  14. }
  15.  
  16.  
  17. class B : public A
  18. {
  19. public:
  20. virtual void func(){
  21. cout<<"B::func"<<endl;
  22. A::func();
  23. };
  24. };
  25.  
  26.  
  27.  
  28. int main() {
  29. // your code goes here
  30. A * a = new B;
  31. a->func();
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
B::func
A::func