fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Foo {};
  5.  
  6. class Bar : public Foo {
  7. public:
  8. void func() { cout << 13; }
  9. };
  10.  
  11. int main() {
  12. Bar bar;
  13. Foo* ptr = &bar;
  14.  
  15. static_cast<Bar*>(ptr)->func();
  16. return 0;
  17. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
13