标签:compile 设计 简单 define name public cti head ack
// my_class.h
class my_class {
   //  ... all public and protected stuff goes here ...
private:
   class impl; unique_ptr<impl> pimpl; // opaque type here
};// my_class.cpp
class my_class::impl {  // defined privately here
  // ... all private data and functions: all of these
  //     can now change without recompiling callers ...
};
my_class::my_class(): pimpl( new impl )
{
  // ... set impl values ... 
}
既能最小化编译依赖,又能接口与实现分离。
标签:compile 设计 简单 define name public cti head ack
原文地址:http://www.cnblogs.com/yutingliuyl/p/7351361.html