1.handle class
PImpl手法,隱藏實(shí)現(xiàn)細(xì)節(jié)。使用指針代替變量定義體。
2.interface class
使用abstract class,純虛函數(shù)(pure function),多態(tài)機(jī)制。用父類的接口調(diào)用具體子類對(duì)象的實(shí)現(xiàn)。
3.頭文件中只能有聲明體,實(shí)現(xiàn)部分放到另一文件中。實(shí)現(xiàn)與聲明分開(kāi)-接口與實(shí)現(xiàn)分離。