From: Fernando Nasser <fnasser@redhat.com>
To: Keith Seitz <keiths@cygnus.com>
Cc: Insight Maling List <insight@sources.redhat.com>
Subject: Re: Overloaded vs variable?
Date: Wed, 14 Mar 2001 10:15:00 -0000 [thread overview]
Message-ID: <3AAFB497.FCACD89A@redhat.com> (raw)
In-Reply-To: <Pine.SOL.3.91.1010302093740.9412O-100000@ryobi.cygnus.com>
I guess whoever wrote it had the following in mind (I am just guessing,
I was not around at the time):
MyWin::something can perform a calculation (check something) whenever
ManagedWin::frob is invoked.
I.e., cause the test for a condition specific to a subclass whenever the
base class method is invoked. This could not be done with a variable
because the invocation is what is determining *when* the evaluation is
done.
I have no idea where this is useful in our code.
Also, the degenerate case (a constant value) does map to a protected
variable. It may be more clear to test for the protected variable than
to use method overloading in that case. I don't have any strong
feelings about it.
As far as I am concerned feel free to change it wherever it makes sense,
if it is more to your taste.
Cheers,
Fernando
Keith Seitz wrote:
>
> Hi,
>
> In my ongoing effort to cleanup managedwin, I've noticed a trend to do
> things like:
>
> Class ManagedWin {
>
> public method something {} { return 1 }
>
> public method frob {} {
> if {[something]} {
> _frob_it
> }
> }
>
> Class MyWin {
> inherit ManagedWin
>
> public method something {} { return 0 }
>
> }
>
> This is supposed to dictate to ManagedWin not to frob MyWin. Question
> is: Why is this any better than just using a protected variable? It
> would seem to me to be a lot cleaner...
>
> Keith
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
prev parent reply other threads:[~2001-03-14 10:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-02 9:45 Keith Seitz
2001-03-14 10:15 ` Fernando Nasser [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=3AAFB497.FCACD89A@redhat.com \
--to=fnasser@redhat.com \
--cc=insight@sources.redhat.com \
--cc=keiths@cygnus.com \
/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).