#ifndef WIDGET_H_
#define WIDGET_H_
#include <vector>
#include <iostream>
using namespace std;
class WidgetImpl {
public:
void DoSomething() { cout << "get it!" << endl; }
private:
int a,b;
std::vector<double> v;
};
class Widget{
public:
void DoSomething() { pImpl->DoSomething(); }
public:
Widget() { pImpl = new WidgetImpl; }
~Widget() { delete pImpl; }
Widget(const Widget& rhs);
Widget& operator= (const Widget& rhs){
*pImpl = *(rhs.pImpl);
}
private:
WidgetImpl* pImpl;
};
#endif
C++ 具体和实现分离
最新推荐文章于 2022-09-12 10:42:28 发布