fork download
  1. /*
  2. test.cpp
  3. © Andrey Bushman, 18 Jun 2013
  4. */
  5. //--------------------------------------------
  6. #include <exception>
  7. #include <iostream>
  8. using namespace std;
  9. //--------------------------------------------
  10. namespace Bushman{
  11. //--------------------------------------------
  12. class MyClass{
  13. public:
  14. MyClass();
  15. };
  16. //--------------------------------------------
  17. MyClass::MyClass(){
  18. void func(); // declaration
  19. func(); // call
  20. }
  21. //--------------------------------------------
  22. void func(){ // definition
  23. cout << "Ping..." << endl;
  24. }
  25. }
  26. //============================================
  27. int main()
  28. try{
  29. namespace B = Bushman;
  30. B::MyClass a;
  31. }
  32. catch(exception& e){
  33. cerr << e.what() << endl;
  34. return 1;
  35. }
  36. catch(...){
  37. cerr << "Unknown exception." << endl;
  38. return 2;
  39. }
  40.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
Ping...