comp.lang.ada
 help / color / mirror / Atom feed
From: agate!spool.mu.edu!sol.ctr.columbia.edu!emory!europa.eng.gtefsd.com!darwi n.sura.net!source.asset.com!cernosek@ucbvax.Berkeley.EDU  (Gary J. Cernosek)
Subject: Re: OO Preprocessor for Ada
Date: 18 Aug 93 22:30:47 GMT	[thread overview]
Message-ID: <1993Aug18.223047.21260@source.asset.com> (raw)

In article <CBz2Cx.8q2@cs.uiuc.edu> rowe@cs.uiuc.edu (Kenneth E. Rowe) writes:
>
>...stuff deleted
>>
>>   with X, Text_IO;
>>   procedure Some_Client is
>>      An_Object : X.Object;
>>      P : Integer;
>>   begin
>>      X.Create (Instance => An_Object, P1 => 7);
>>      X.Modify (An_Object, P1 => 3);
>>      P := X.P1 (An_Object);
>>      Text_IO.Put ("The value of P1 is: ");
>>      Text_IO.Put ( Integer'IMAGE(P) );
>                     ^^^^^^^^^^^^^^^^
>Since X.Object is a tagged limited private type, can you 
>actually do an Integer'IMAGE on P?

Note that I am simply taking the 'IMAGE of an object P, which is itself
of type Integer.  P is assigned the result of the selector call, seen a
couple of lines before the one in question.  Since the function X.P1
returns a value of type Integer, this statement is OK.  But you're
right, one cannot take the 'IMAGE of a private object.

Note that I could have eliminated the local variable P altogether:

   Text_IO.Put ( Integer'IMAGE (X.P1(An_Object) ) );

One could argue about which style is more "readable;" but in any event,
the 'IMAGE attribute must be applied to an Integer-typed value.

-- 
Gary J. Cernosek
Fastrak Training Inc.
Houston Office: (713) 280-4768
E-mail: cernosek@source.asset.com

             reply	other threads:[~1993-08-18 22:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-18 22:30 agate!spool.mu.edu!sol.ctr.columbia.edu!emory!europa.eng.gtefsd.com!darwi [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-08-19 19:03 OO Preprocessor for Ada cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!vixen.cso.u
1993-08-19 10:36 Graham Matthews
1993-08-18 20:31 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!vixen.cso.u
1993-08-18 19:22 cis.ohio-state.edu!math.ohio-state.edu!darwin.sura.net!source.asset.com!c
1993-07-21 14:41 David Emery
1993-07-19 14:32 news.cnri.reston.va.us!newsserver.jvnc.net!louie!balin.cis.udel.edu!carro
1993-07-16 15:58 Robert I. Eachus
1993-07-15 14:46 Tucker Taft
1993-07-15 13:02 dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!math.ohio-st
replies disabled

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