PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/projects/SATIrE/examples/constprop/tests/destructor.C

https://github.com/GoblinInventor/edg4x-rose
C++ | 31 lines | 26 code | 5 blank | 0 comment | 0 complexity | 776795946cc4336a11e8e8f569d3ca5e MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause, Apache-2.0
  1. #include <iostream>
  2. #include <string>
  3. class A
  4. {
  5. public:
  6. A(std::string s) : varname(s)
  7. {
  8. std::cout << "constructor for '" << varname<< "' called" << std::endl;
  9. }
  10. ~A()
  11. {
  12. std::cout << "destructor for '" << varname<< "' called" << std::endl;
  13. }
  14. private:
  15. A();
  16. std::string varname;
  17. };
  18. int main()
  19. {
  20. A a("a");
  21. {
  22. A b("b");
  23. }
  24. std::string foo("foo");
  25. return 0;
  26. }