标签:
class Singleton {
public:
static Singleton* getInstance();
private:
Singleton() {}
//Singleton(const Singleton&);
//Singleton& operator=(const Singleton&);
static Singleton* instance;
};
Singleton* Singleton::instance = NULL;
Singleton* Singleton::getInstance() {
if (instance == NULL) {
instance = new Singleton();
}
return instance;
}
/* 子类A,实现具体方法 */
class PageA: public AbstractPage {
public:
void getInfo();
void createWidget();
};
void PageA::getInfo() {
cout<<"Get page A‘s info"<<endl;
}
void PageA:: createWidget() {
cout<<"create page A‘s view with the info"<<endl;
}
/* 子类B,实现具体方法 */
class PageB: public AbstractPage {
public:
void getInfo();
void createWidget();
};
void PageB::getInfo() {
cout<<"Get page B‘s info"<<endl;
}
void PageB:: createWidget() {
cout<<"create page B‘s view with the info"<<endl;
}
标签:
原文地址:http://www.cnblogs.com/hushpa/p/4488389.html