Posted by Anonymous Wed 14th Mar 2007 15:51 - Syntax is C++ - 16 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
-
faux@molotov:~$ cat uhoh.cpp
-
#include
-
-
int global=0;
-
-
class A
-
{
-
public:
-
A()
-
{
-
std::cout << "COPEH " << ++global << std::endl;
-
}
-
~A()
-
{
-
std::cout << "die! " << global-- << std::endl;
-
}
-
void print()
-
{
-
std::cout << "stuff" << std::endl;
-
}
-
};
-
-
A foo()
-
{
-
A local;
-
std::cout << "Inner foo" << std::endl;
-
return local;
-
}
-
-
int main()
-
{
-
A b = foo();
-
b.print();
-
}
-
-
faux@molotov:~$ g++ -O0 uhoh.cpp && ./a.out
-
COPEH 1
-
Inner foo
-
stuff
-
die! 1
-
faux@molotov:~$
-
PermaLink to this entry https://pastebin.co.uk/11864
Posted by Anonymous Wed 14th Mar 2007 15:51 - Syntax is C++ - 16 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
Comments: 0