public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: John Love-Jensen <eljay@adobe.com>
To: Francois Coulon <francois.coulon@gmail.com>
Cc: MSX to GCC <gcc-help@gcc.gnu.org>
Subject: Re: public method hidden by protected one
Date: Mon, 26 Nov 2007 16:00:00 -0000	[thread overview]
Message-ID: <C3702234.27197%eljay@adobe.com> (raw)
In-Reply-To: <5826f8920711260448w24244066of796d08507c4015f@mail.gmail.com>

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


      reply	other threads:[~2007-11-26 13:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 11:42 Francois Coulon
2007-11-26 12:48 ` John Love-Jensen
2007-11-26 13:12   ` Francois Coulon
2007-11-26 16:00     ` John Love-Jensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C3702234.27197%eljay@adobe.com \
    --to=eljay@adobe.com \
    --cc=francois.coulon@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).