G
Guofu Chen
Hi,
In TC++PL, Chapter 10, there is an exercise which ask us to modify the
following program:
#include <iostream>
int main()
{
std::cout << "Hello, world!/n" ;
return 0;
}
so that the output would be:
Initialize
Hello, world!
Clean up
but we should not change main().
I believe we will have to modify the constructor and desctructor of class
"ostream" so that the constructor of "ostream" will output
Initialize
and the destructor of "ostream" will output
Clean up
But I don't know if my idea is correct. Is there better idea? Thanks!
In TC++PL, Chapter 10, there is an exercise which ask us to modify the
following program:
#include <iostream>
int main()
{
std::cout << "Hello, world!/n" ;
return 0;
}
so that the output would be:
Initialize
Hello, world!
Clean up
but we should not change main().
I believe we will have to modify the constructor and desctructor of class
"ostream" so that the constructor of "ostream" will output
Initialize
and the destructor of "ostream" will output
Clean up
But I don't know if my idea is correct. Is there better idea? Thanks!