Re: public method hidden by protected one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux