After reading an article on private inheritance Im wondering if I should use private inheritance in the following example instead of public.
I used public till now, but Im thinking its not the right choice. The CardDealAnimation does model the "is-a" relationship but it should not provide an interface to further subclasses. So whats better, public or private or is it both 100% correct from a modeling POV?Code:class CAnimation { explicit CAnimation(unsigned long Timer); virtual ~CAnimation(); protected: virtual Status Init() = 0; virtual void Render() = 0; virtual Status Update(unsigned long TimeElapsed) = 0; virtual void Cleanup() = 0; virtual bool IsDone(); }; class CardDealAnimation : public CAnimation { public: CardDealAnimation(CSprite *HandSprites, int HandSize); virtual Status Init(); virtual void Render() {} virtual Status Update(unsigned long Time) {} virtual void Cleanup() {} virtual bool IsDone() {} };
Here's the article
Cprogramming.com - Tutorials - Understanding Private Inheritance