comp.lang.ada
 help / color / mirror / Atom feed
* Upcasting
@ 2002-11-05 11:43 Matthew Baulch
  2002-11-05 12:49 ` Upcasting Lutz Donnerhacke
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matthew Baulch @ 2002-11-05 11:43 UTC (permalink / 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)



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

end of thread, other threads:[~2002-11-06 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05 11:43 Upcasting Matthew Baulch
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

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