MoreEffectiveC++Item35 條款27: 要求或禁止對象產生於heap中

一 要求對象產生在heap中 阻止對象產生產生在non-heap中最簡單的方法是將其構造或析構函數聲明在private下,用一個public的函數去調用起構造和析構函數 class UPNumber { public: UPNumber(); UPNumber(int initValue); UPNumber(double initValue); UPNumber(
相關文章
相關標籤/搜索