I am confused because I found some information about lifetime of object in C++:
https://en.cppreference.com/w/cpp/language/lifetime
For any object of class types whose destructor is not trivial, lifetime ends when the execution of the destructor begins.
Why, is there any rationale?
If that means I shouldn't do this?
#include <iostream> class Foo { public: Foo() = default; Foo(const Foo&) = default; ~Foo() { std::cout << member; } int member = 666; }; int main() { Foo a; }