From: Andreas Winckler <andreas.winckler@frqnet.de>
Subject: Re: Inheritance and Polymorphism in Ada !!
Date: 1999/10/15
Date: 1999-10-15T07:46:45+00:00 [thread overview]
Message-ID: <3806DC34.1513E8B1@frqnet.de> (raw)
In-Reply-To: 7u64k3$l1d$1@hiline.shinbiro.com
Chango Cho schrieb:
>
> Do they exist in Ada?
Yes, but in my opinion polymorphism is kind of restricted in Ada.
See this example:
1 procedure inheritance_polymorphism is
2
3 type type_a is tagged record
4 first_field : integer;
5 end record;
6
7 type type_b is new type_a with record
8 second_field : integer;
9 end record;
10
11 type pointer_type is access all type_a'class;
12 pointer : pointer_type;
13
14 begin
15 pointer := new type_b;
16 type_b(pointer.all).second_field := 1;
17 end inheritance_polymorphism;
See line 16, the type of the referenced object must be known in advance.
With "pointer.second_field :=1" the compiler fails. It seems that the
strong typing restricts the features of polyormism in Ada. Any comments?
Am I wrong?
However, when it comes to real_world_applications like the air traffic
control systems I do, polymorphism and dynamic memory allocation is a
DO_NOT anyway.
Greetings,
AW
--
=========================================================
Andreas Winckler
Dipl.-Ing.
Software engineering
FREQUENTIS Network Systems GmbH
Tel: (+49) (7541) 282 - 462 Fax: (+49) (7541) 282 - 299
http://www.frqnet.de
next prev parent reply other threads:[~1999-10-15 0:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-15 0:00 Inheritance and Polymorphism in Ada !! Chango Cho
1999-10-15 0:00 ` Lutz Donnerhacke
1999-10-15 0:00 ` Ted Dennison
1999-10-15 0:00 ` Andreas Winckler [this message]
1999-10-15 0:00 ` Stephane Barbey
1999-10-15 0:00 ` Richard D Riehle
1999-10-15 0:00 ` Matthew Heaney
1999-10-15 0:00 ` Richard D Riehle
1999-10-18 0:00 ` Robert Dewar
1999-10-23 0:00 ` Richard D Riehle
1999-10-24 0:00 ` Robert Dewar
1999-10-24 0:00 ` Brian Rogoff
1999-10-26 0:00 ` Robert Dewar
1999-10-25 0:00 ` Robert A Duff
1999-10-26 0:00 ` Robert Dewar
1999-10-26 0:00 ` Robert A Duff
1999-10-18 0:00 ` Robert A Duff
1999-10-19 0:00 ` Robert Dewar
1999-10-20 0:00 ` Robert A Duff
1999-10-21 0:00 ` Simon Wright
1999-10-21 0:00 ` Robert A Duff
1999-10-21 0:00 ` Paul Duquennoy
1999-10-21 0:00 ` Robert Dewar
1999-10-22 0:00 ` Matthew Heaney
1999-10-15 0:00 ` tmoran
1999-10-15 0:00 ` tmoran
1999-10-15 0:00 ` Matthew Heaney
1999-10-18 0:00 ` Robert A Duff
1999-10-18 0:00 ` Brian Rogoff
1999-10-15 0:00 ` Lutz Donnerhacke
1999-10-18 0:00 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox