------- Comment #2 from CyrusOmega at gmail dot com  2007-07-30 12:04 -------
(In reply to comment #1)
> Well it is valid as B::print hides A::print.
> Try doing:
> #include <iostream>
> class A {
> public:
>     virtual char * print() const { return "A\n";}
>     virtual ~A(){};
> };
> class B : public A {
> public:
>     virtual char * print() { return "B\n";}
>     using A::print;
>     virtual ~B(){};
> };
> 
> int main ()
> {
>     B b;
>     A & a = b;
>     const B &b1 = b;
>     std::cout << a.print() << b1.print();
> }
> 
> Which shows that b1.print will call A::print.  If you don't include using
> A::print, then A::print wil be hidden in B.
> 

The problem I am seeing is that I want to inherit from a virtual const function
but I don't want MY derived function to be const. Just because my parent class
thought the member should be const doesn't mean I agree, or am I simply
restricted? 

Thanks, and again I am sorry if this is simply a lack of my understanding of
C++.

Andrew


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32934

Reply via email to