fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Hoge {
  5. public:
  6. void hage() { cout << "hage\n"; }
  7. static void HAGE() { cout << "HAGE\n"; }
  8. };
  9.  
  10. class Child : public Hoge {
  11. public:
  12. void hage() { cout << "Child\n"; }
  13. };
  14.  
  15. int main() {
  16. cout << "---direct\n";
  17. Hoge::HAGE();
  18. Child::HAGE();
  19.  
  20. cout << "---from instance\n";
  21. Hoge inst;
  22. inst.hage();
  23. inst.HAGE();
  24.  
  25. Child inst2;
  26. inst2.hage();
  27. inst2.HAGE();
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5496KB
stdin
Standard input is empty
stdout
---direct
HAGE
HAGE
---from instance
hage
HAGE
Child
HAGE