comp.lang.ada
 help / color / mirror / Atom feed
From: "Stephane Barbey" <Stephane@Paranor.ch>
Subject: Re: Inheritance and Polymorphism in Ada !!
Date: 1999/10/15
Date: 1999-10-15T08:38:59+00:00	[thread overview]
Message-ID: <7u6p73$pgi$1@pollux.ip-plus.net> (raw)
In-Reply-To: 3806DC34.1513E8B1@frqnet.de

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 960 bytes --]


Andreas Winckler <andreas.winckler@frqnet.de> wrote in message
news:3806DC34.1513E8B1@frqnet.de...
> 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?

This would be illegal in all other OO languages I know of.
For instance, in Java:

public class A {
    int first_field;
}

public class B extends A {
      int second_field;
}

import A;
import B;
public class inheritance_polymorphism {

  public static void main(String[] args) {
    A pointer = new B();

    pointer.second_field = 1;              /* illegal */
    ((B)pointer).second_field = 1;      /* legal */
  }

}

-St�phane


----
Stephane Barbey, PhD   phone: +41(31)828.92.17
Paranor AG             fax:   +41(31)828.92.99
3046 Wahlendorf            stephane@paranor.ch
Switzerland      http://lglwww.epfl.ch/~barbey






  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 ` Andreas Winckler
1999-10-15  0:00   ` tmoran
1999-10-15  0:00     ` tmoran
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             ` Robert Dewar
1999-10-21  0:00             ` Paul Duquennoy
1999-10-21  0:00             ` Simon Wright
1999-10-21  0:00               ` Robert A Duff
1999-10-22  0:00         ` Matthew Heaney
1999-10-15  0:00   ` Stephane Barbey [this message]
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
1999-10-15  0:00 ` Ted Dennison
1999-10-15  0:00 ` Lutz Donnerhacke
replies disabled

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