fork(1) download
  1. #include <iostream>
  2.  
  3. class A {
  4. public:
  5. void virtual test() {
  6. std::cout << "Lolka" << std::endl;
  7. }
  8. };
  9.  
  10. class B: public A {
  11. public:
  12. void virtual test() override {
  13. std::cout << "Ne lolka" << std::endl;
  14. }
  15. };
  16.  
  17. int main(int argc, char **argv) {
  18. B b;
  19.  
  20. static_cast<A>(b).test();
  21. static_cast<B>(b).test();
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
Lolka
Ne lolka