comp.lang.ada
 help / color / mirror / Atom feed
* simulate inheritance with generic package
@ 2003-08-25  1:25 WATANABE Katsuhiro
  2003-08-25  2:04 ` Matthew Heaney
  2003-08-25 14:25 ` Robert C. Leif
  0 siblings, 2 replies; 3+ messages in thread
From: WATANABE Katsuhiro @ 2003-08-25  1:25 UTC (permalink / raw)


I'd like to know how to simulate inheritance in OO with
generic package in classic Ada, which has no tagged type.

An ancient OO book(*) instructs a way of inheritance
implementation in Ada by introducing has-a reference from
child class to parent class. And it says their functions
should be linked, that is to say, any call to the child
instance must be delegated to the parent instance. And
the description goes on as follows:

> If you use generic package this linkage can be made
> by using a specific routine as the relevant (generic)
> parameter when instantiating the package.

But, what does 'a specific routine' means?

As I am a Smalltalk programmer, I have limited knowledge
on Ada and its instanciation mechanism of generic package.
So, I'd appreciate your help showing concretely what 
'a specific routine' is.

(*)
Ivar Jacobson;
Object-Oriented Software Engineering
--- A Use Case Driven Approach ---;
Addison-Wesley;
1994

-- 
WATANABE Katsuhiro



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: simulate inheritance with generic package
  2003-08-25  1:25 simulate inheritance with generic package WATANABE Katsuhiro
@ 2003-08-25  2:04 ` Matthew Heaney
  2003-08-25 14:25 ` Robert C. Leif
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Heaney @ 2003-08-25  2:04 UTC (permalink / raw)


WATANABE Katsuhiro <katsu@watanabe.name> writes:

> I'd like to know how to simulate inheritance in OO with
> generic package in classic Ada, which has no tagged type.

Don't bother.  The only reason you need inheritance is for dynamic
binding, which you don't have anyway in Ada83.

What is your interest in Ada83?  Why can't you use Ada95?


> As I am a Smalltalk programmer, I have limited knowledge
> on Ada and its instanciation mechanism of generic package.
> So, I'd appreciate your help showing concretely what 
> 'a specific routine' is.

Perhaps he means "generic actual subprogram"?

If all you want to do is reuse a subprogram, then you don't need
inheritance.  Simply provide the reuseable functionality in its own
subprogram, and then call the subprogram.

No inheritance is necessary.  No generics either, for that matter.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: simulate inheritance with generic package
  2003-08-25  1:25 simulate inheritance with generic package WATANABE Katsuhiro
  2003-08-25  2:04 ` Matthew Heaney
@ 2003-08-25 14:25 ` Robert C. Leif
  1 sibling, 0 replies; 3+ messages in thread
From: Robert C. Leif @ 2003-08-25 14:25 UTC (permalink / raw)
  To: 'WATANABE Katsuhiro', Comp. Lang. Ada

You can also create generic types and objects for the fields of a tagged
record that is contained in a generic package. In Ada it is not generic or
tagged; they can be combined to serve as an excellent model for real-world
objects. Unfortunately, it is not obvious how to handle a record's tag when
creating a representation specification of hardware, such as a register or
memory address.

Bob Leif
Robert C. Leif, Ph.D.
Email rleif@rleif.com

-----Original Message-----
From: WATANABE Katsuhiro [mailto:katsu@watanabe.name] 
Sent: Sunday, August 24, 2003 6:25 PM
To: comp.lang.ada@ada.eu.org
Subject: simulate inheritance with generic package

I'd like to know how to simulate inheritance in OO with
generic package in classic Ada, which has no tagged type.

An ancient OO book(*) instructs a way of inheritance
implementation in Ada by introducing has-a reference from
child class to parent class. And it says their functions
should be linked, that is to say, any call to the child
instance must be delegated to the parent instance. And
the description goes on as follows:

> If you use generic package this linkage can be made
> by using a specific routine as the relevant (generic)
> parameter when instantiating the package.

But, what does 'a specific routine' means?

As I am a Smalltalk programmer, I have limited knowledge
on Ada and its instantiation mechanism of generic package.
So, I'd appreciate your help showing concretely what 
'a specific routine' is.

(*)
Ivar Jacobson;
Object-Oriented Software Engineering
--- A Use Case Driven Approach ---;
Addison-Wesley;
1994

-- 
WATANABE Katsuhiro




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-25 14:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-25  1:25 simulate inheritance with generic package WATANABE Katsuhiro
2003-08-25  2:04 ` Matthew Heaney
2003-08-25 14:25 ` Robert C. Leif

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox