simple::~simple is a destructor and is called automatically when the object is being destructed, you can never call it yourself ...
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
when will simple::~simple() be called? after the execution of main finishes?
When the execution of main finishes, just before the program exits the destructor will be called ...
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
You can easily test that, just put some messages in the destructor and some in the program itself to see its place right? ;)
Yes, that's true. The C++ Standard requires that objects associated with std::cin, std::cout and std::cerr are destroyes after destruction of user-defined objects with static duration:Constructors and destructors for static objects can access these objects to read input from stdin or write output to
stdout or stderr.
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
standard input , output and the error is a operating system concept, as in linux and they are never destructed , but C++ object associated with them get destructed after destruction of user-defined objects with static duration.
It seems you did not understand my post. What for you reprint the same sentence? ;)
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348