From: Marin David Condic <nobody@noplace.com>
Subject: Abstract Operations On A Tagged Record
Date: Sat, 30 Oct 2004 13:04:37 GMT
Date: 2004-10-30T13:04:37+00:00 [thread overview]
Message-ID: <FjMgd.12476$5i5.2958@newsread2.news.atl.earthlink.net> (raw)
Can someone clarify my understanding (perhaps again) on abstract
operations and the implications as a class heierarchy is being
constructed? Specifically, what I want is something like this:
A base class has an abstract operation, but I may not yet know the data
types of the parameters - or possibly even the number of parameters.
Let's say what I want is like this:
procedure Some_Op (<TBD Parameter List>) is abstract ;
When I get to the child class, what I really need is:
procedure Some_Op (Some_Param1 : in Integer; Some_Param2 : in Float) ;
For a different child class I may want:
procedure Some_Op (Some_Param1 : in Integer; Some_Param2 : in Character;
Some_Param3 : in Boolean) ;
The base class wants to express the basic necessity of "Some_Op" but it
really doesn't know if it will have 1, 2 or N parameters or of what
type. My understanding is that if I express that as an abstract
operation, when I get to the child class, I'll have to supply a real
operation of the same name and same parameter profile. (Or can I use a
different parameter profile & satisfy the need for a concrete
implementation of the abstract op? My recollection is the compiler
whines about it or creates an overloading. Is this correct?)
I realize I can make another procedure "Some_Op" with a different
parameter list and that overloading will take care of me, but then I
didn't really need the abstract procedure in the first place, did I? It
becomes unnecessary baggage that you have to fill in just because its
there, but you have no intention of using it.
Do I understand this correctly? Is there away around it? Keep in mind
that what I want to express is the notion in a base class that Operation
X needs to be present, but the precise parameters to X will be
determined by the child class. I'm interested *specifically* in how this
works with an abstract tagged record and the inheritance heierarchy that
goes with it, so please don't suggest that I'm going about it all wrong
and I really need to do something with a generic, etc... If my
understanding is correct and it can't be done then we just trash that
notion and go to other techniques, but I want to know how this
capability works. Thanks.
MDC
--
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jsf.mil/NSFrames.htm
Send Replies To: m o d c @ a m o g
c n i c . r
"Power corrupts. Absolute power is kind of neat"
-- John Lehman, Secretary of the Navy 1981-1987
======================================================================
next reply other threads:[~2004-10-30 13:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-30 13:04 Marin David Condic [this message]
2004-10-30 14:34 ` Abstract Operations On A Tagged Record Dmitry A. Kazakov
2004-10-30 16:07 ` Nick Roberts
2004-11-01 12:58 ` Marin David Condic
2004-11-01 18:09 ` Nick Roberts
2004-11-01 22:27 ` Marin David Condic
2004-11-06 13:17 ` Marin David Condic
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox