Ray's playground

 

Item 39: Use private inheritance judiciously(Effective C++)

  • Private inheritance means is-implemented-in-terms of. It's usually inferior to composition, but it makes sense when a derived class needs access to protected base class members or needs to redefine inherited virtual functions.

  • Unlike composition, private inheritance can enable the empty base optimization. This can be important for library developers who strive to minimize object sizes.

posted on 2011-04-04 22:16  Ray Z  阅读(186)  评论(0编辑  收藏  举报

导航