1: #ifndef _SINGAPP_H_
2: #define _SINGAPP_H_
3:
4:
5: #include <iostream>
6: #include <string>
7:
8: #include "singl_tmpl.h"
9:
10: using namespace std;
11:
12: class MyClass
13: {
14: public:
15: friend class CSingleton<MyClass>;
16: void print() const { cerr << outstring << endl; };
17: void set_outstring( const char * const new_string ) { outstring = new_string; };
18:
19: private:
20: // Dtor + Ctor can only be privat if CSingleton<MyClass> is declared as friend!
21: MyClass() : outstring( "Hello Single Class!" )
22: {
23: cerr << "MyClass()" << endl;
24: };
25:
26: ~MyClass() { cerr << "~MyClass()" << endl; };
27:
28: string outstring;
29: };
30: #endif // _SINGAPP_H_
31: