Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Right.</p> <p>Now reality check&hellip;</p> <p>MinGW g++ 4.4.1:</p> <blockquote> <p>x.cpp: In function 'int main()': x.cpp:3: error: 'void Base::foo()' is inaccessible<br> x.cpp:15: error: within this context</p> </blockquote> <p>Visual C++ 10.0:</p> <blockquote> <p>x.cpp(15) : error C2248: 'Derived::foo' : cannot access private member declared in class 'Derived'<br> x.cpp(9) : see declaration of 'Derived::foo'<br> x.cpp(6) : see declaration of 'Derived'</p> </blockquote> <p><a href="http://www.comeaucomputing.com/tryitout/" rel="nofollow">Comeau Online</a> 4.3.10.1:</p> <blockquote> <p>In strict mode, with -tused, Compile succeeded (but remember, the Comeau online compiler does not link).<br> Compiled with C++0x extensions enabled.</p> </blockquote> <p><em>Oops</em>. And Comeau is the one that's nearly always right! Well, turning off C++0x extensions, for C++98/C++03:</p> <blockquote> <p>In strict mode, with -tused, Compile succeeded (but remember, the Comeau online compiler does not link).<br> Compiled with C++0x extensions DISabled.</p> </blockquote> <p><strong>Oops!</strong></p> <p>Well, you biggie mine, as they say in Norway (literally translated to English).</p> <p>I'd try to report that to Comeau.</p> <p><strong>EDIT</strong>: since Prasoon has also answered, quoting the Holy Standard with his interpretation of that contradicting what I wrote above, well, OK, standadeese&hellip;</p> <p>§11.3/1 "The access of a member of a base class can be changed in the derived class&hellip;", and so on, which is as clear as can be (no interpretation required). And with a concrete example. And normative text stating that that is equivalent to a <code>using</code> declaration.</p> <p>Cheers &amp; hth.,</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload