Hi All,
I am working on a project that has a large base class that uses a baseUtil class:
Code:Class BaseClass { public: BaseUtil m_baseUtil; }
I have derived both these classes: DerivedClass and DerivedUtil
The BaseClass and BaseUtil are huge classes; BaseClass calls BaseUtils at multiple instances. I am inheriting most of the features and making very few changes in the derived classes.Code:Class DerivedClass : public BaseClass { public: DerivedUtil m_derivedUtil; }
My objective is: I want BaseClass to use DerivedUtil instead of BaseUtil.
The problem is: BaseClass is using a regular object, and not pointer, for BaseUtil. Further, the BaseUtil has disabled copy constructor and assignment operator with the following code in the "private" section
Is there an elegant solution, or should I just make changes in BaseClass and BaseUtil rather than using inheritance and polymorphism.Code:BaseUtil(const BaseUtil&right); BaseUtil& operator=(const BaseUtil&right);
Thanks for looking.
best,
SG




Reply With Quote