fork download
  1. #include <iostream>
  2.  
  3. class ITest {
  4. public:
  5. ITest(){}
  6. virtual ~ITest(){}
  7. virtual void foo() {
  8. if (!this) {
  9. std::cout << "ITest::Blah!" <<std::endl;
  10. return;
  11. }
  12. std::cout << "ITest::Foo!" <<std::endl;
  13. }
  14. };
  15.  
  16. class Test : public ITest {
  17. public:
  18. virtual void foo() {
  19. if (!this) {
  20. std::cout<<"Blah!"<<std::endl;
  21. return;
  22. }
  23. std::cout<<"Foo!"<<std::endl;
  24. }
  25. };
  26.  
  27. int main() {
  28. Test* t = NULL;
  29. t->foo();
  30. return 0;
  31. }
Runtime error #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty