B*********h 发帖数: 800 | 1 ☆─────────────────────────────────────☆
eccentric (eccentric) 于 (Thu Mar 22 12:31:00 2007) 提到:
This question does not come from an interview. However, since a lot of folks
here are interested in C++ and experts on C++, so I would expect some
helpful comments here.
There is an implementation of the Singleton pattern in Bruce Eckel's
"Thinking in C++" vol. 2, pp 620. It is as follows:
class Singleton {
static Singleton s;
public:
static Singleton& instance() {
|
|