/projects/SATIrE/examples/constprop/tests/destructor.C
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
- #include <iostream>
- #include <string>
- class A
- {
- public:
- A(std::string s) : varname(s)
- {
- std::cout << "constructor for '" << varname<< "' called" << std::endl;
- }
- ~A()
- {
- std::cout << "destructor for '" << varname<< "' called" << std::endl;
- }
- private:
- A();
- std::string varname;
- };
- int main()
- {
- A a("a");
- {
- A b("b");
- }
- std::string foo("foo");
- return 0;
- }