It's difficult to understand the context here without some code, but have you considered inheriting publically, but making the class functions you want invisible protected?
That way class B can see the protected member functions of class A but the functions are not public to those outside.Code:class A { public: int publicFunction(){return 5;} virtual ~A(){} protected: int protectedFunction(){return 7;} }; class B : public A { }; int main() { B b; std::cout << b.publicFunction() << std::endl; //OK std::cout << b.protectedFunction() << std::endl; //compile error };




Reply With Quote