B
blackswift
Hello,all
I hava a problem that
when did cout call its destructor?
I used GCC compiler under linux , It compiles OK.
and gives me :
cons
des
as I haved expected.
But I use Visual C++ 6.0(I know it is far from standard..)
It will not give correct answer.
(cout's destructor is called before a's)
I want to know how STANDARD acts in this sitution.
thanks in advance.
#include <iostream>
using namespace std;
class A {
public:
A() {
cout << "cons " << endl;
}
~A() {
cout << "des " << endl;
}
};
A a;
int main()
{
return 0;
}
I hava a problem that
when did cout call its destructor?
I used GCC compiler under linux , It compiles OK.
and gives me :
cons
des
as I haved expected.
But I use Visual C++ 6.0(I know it is far from standard..)
It will not give correct answer.
(cout's destructor is called before a's)
I want to know how STANDARD acts in this sitution.
thanks in advance.
#include <iostream>
using namespace std;
class A {
public:
A() {
cout << "cons " << endl;
}
~A() {
cout << "des " << endl;
}
};
A a;
int main()
{
return 0;
}