comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Baulch" <matt@greenroom.com.au>
Subject: Upcasting
Date: Tue, 05 Nov 2002 22:43:32 +1100
Date: 2002-11-05T11:43:51+00:00	[thread overview]
Message-ID: <pan.2002.11.05.11.43.31.117258@greenroom.com.au> (raw)

For the records:

...
type Base is tagged with
  record
    Base1, Base2 : Integer;
  end record;

type Derived is new Base with
  record
    Derived1, Derived2 : Float;
  end record;
...
Foo1 : Base;
Foo2 : Derived;
...

Obviously to assign Foo2 to Foo1 you would:
	Foo1 := Base(Foo2);

But if you wanted to assign Foo1 to Foo2:
	Foo2 := (Foo1 with 5.0, 10.0);
would work.

My question is: How would you do this 'upcasting' if varying
types existed? Obviously the compiler could tell where each
value must go based on their type if only one of their type
was needed in the transition. How does this type of thing work?
(or does the A95 compiler not allow it)



             reply	other threads:[~2002-11-05 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-05 11:43 Matthew Baulch [this message]
2002-11-05 12:49 ` Upcasting Lutz Donnerhacke
2002-11-05 17:33 ` Upcasting Stephen Leake
2002-11-06  6:26   ` Upcasting Matthew Baulch
2002-11-06 15:18 ` Upcasting Georg Bauhaus
replies disabled

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