Private Inheritance and Derived Object to Base reference
<p>As far as I understand the reason that we cannot pass a derived class object to a base class reference for private inheritance is that Since Derived is privately inherited from Base, the default constructor of Base would be called before the constructor of Derived. But because it is private and not inherited to Derived, we get a compiler error.</p>

<p>But, if I try to create a public constructor for Base and inherit from Derived privately and then re-assign the public status to Base's constructor will it allow me to pass a derived's instance to Base reference?</p>

<p>I tried it as follows,</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

class base
{
      public:
             base(){}
             void print(){ puts("In base"); }
};

class derived : private base
{
      public:
             base::base;   /* Throws an error - Declaration doesnt declare anything*/
             void print(){ puts("In derived"); }
};

void func(base&amp; bRef)
{
}

int main()
{
    derived dObj;
    func(dObj); /*  Throws an error - 'base' is an inaccessible base of derived */
}
</code></pre>

<p>It throws an error for base::base (publicizing privately inherited constructor to public).
Is what I am trying valid? Can anyone please tell me?</p>
