jfs
public cpp v1 · immutable#include <stdio.h>class Foo {public: static int count; Foo(_TCHAR *place = _T("unknown")) { _tprintf(_T("Constructing Foo number %d from %s\n"), ++count, place); }};int Foo::count = 0;Foo staticfoo(_T("static initialiser"));Foo staticfoo2;int _tmain(int argc, _TCHAR* argv[]){ Foo stackfoo(_T("main (on stack)")); Foo *heapfoo = new Foo(_T("main (on heap")); delete heapfoo; return 0;}