I am learning about class inheritance and I wanted to know how one can create a pointer to a class that was inherited privately by another class? I've included a simple example below. Many thanks to those who help in answering this question.
class A: private std::string
{
public:
A(){}
~A(){}
void func1()
{
// I want a pointer that points to the std::string object. Then I will use that pointer in this function
}
};
As simple as
Since
A
derives fromstd::string
,A*
is implicitly convertible tostd::string*
(where that base class is in fact accessible, of course).