The code: struct base { protected: virtual void foo() {} }; struct der : public base { virtual void foo() { p->foo(); } base* p; };
gets you: ~/ootbc/sim/test$ g++ foo.cc foo.cc: In member function 'virtual void der::foo()': foo.cc:3: error: 'virtual void base::foo()' is protected foo.cc:7: error: within this context -- Summary: "protected" protects againt derived class Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31454