public method hidden by protected one
John Love-Jensen
eljay@adobe.com
Mon Nov 26 16:00:00 GMT 2007
Hi François,
> But why should this prevent from calling a const method ?
Because it's a non-const pointer, and there is a non-const method which is
an exact unambiguous signature match, and that non-const method has
protected accessibility.
Add a const_instance method that returns a const pointer, and then use that.
Or don't overload the same method name with different accessibility.
Or don't overload the same method name at all, rather have different named
methods. (This is the option that I think is best, because it is obvious to
me that the two methods are not conceptually the "same thing" for which
overloading is appropriate. They are different things, strongly indicated
by them having different accessibility.)
HTH,
--Eljay
More information about the Gcc-help
mailing list