(C++) DestructorExample2
February 24, 2017 · View on GitHub
(C++) DestructorExample2
Technical facts
Operating system(s) or programming environment(s)
Lubuntu 15.04 (vivid)
Qt Creator 3.1.1
- G++ 4.9.2
Libraries used:
STL: GNU ISO C++ Library, version
4.9.2
Qt project file: ./CppDestructorExample2/CppDestructorExample2.pro
include(../../ConsoleApplication.pri) SOURCES += main.cpp
./CppDestructorExample2/main.cpp
#include <iostream> struct A { ~A() noexcept { std::cout << "~A\n"; } }; struct B { ~B() noexcept { std::cout << "~B\n"; } }; struct Alphabetic { A a; B b; }; struct Reverse { B b; A a; }; int main() { { Alphabetic(); } { Reverse(); } } /* Screen output: ~B ~A ~A ~B */