条款15:在资源管理类中提供对原始资源的访问
std::tr1::shared_ptr<Investment> pInv(new Investment());
int deysHeld(const Investment* pi);class Font {
public:
...
FontHandle get() const { return f; } // 显式转换;
operator FontHandle() const { return f; } // 隐式转换;
private:
FontHandle f;
};
// 隐式转换会增加错误发生的概率;
Font f1(new FontHandle();
FontHandle f2 = f1; // 原意是要拷贝一个 Font 对象;Last updated