From: dweller@dfw.net (David Weller)
Subject: Re: Help with Text_IO Instantiation!
Date: 1996/04/24
Date: 1996-04-24T00:00:00+00:00 [thread overview]
Message-ID: <4lls8g$5vb@dfw.dfw.net> (raw)
In-Reply-To: 4llqlg$i49@newsbf02.news.aol.com
In article <4llqlg$i49@newsbf02.news.aol.com>,
John Herro <johnherro@aol.com> wrote:
>rgelb@csulb.edu (Robert Gelb) wrote:
>> type string is array(integer range 1..10) of character;
>> type SaType is array(integer range <>) of string;
>> StrArray:SaType(1..5);
>> begin
>> put(StrArray(1));.
>> What kind of Text_IO instatiation do I need to
>> make 'put(StrArray(1));' work?
[Good advice from John trimmed...]
>ever, want to define your own string type. *Subtypes* of the built-in
>type String are perfectly OK, and, since subtypes do not create a new
>type, Ada.Text_IO works fine for them.
> I hope this helps, and I hope it clears up more confusion than it
>causes!
>- John Herro
>Software Innovations Technology
>http://members.aol.com/AdaTutor
>ftp://members.aol.com/AdaTutor
What John means, of course, is that you want to probably do something
like this:
procedure sub is
subtype Tiny_String is String(1..12);
type Tiny_Array is array(integer range <>) of Tiny_String;
TA : Tiny_Array(1..10);
begin
TA(1) := "Ohmygoodness";
put_Line(Ta(1));
end sub;
Note that you could not simply declare:
type Tiny_Array is array(String) of Tiny_String;
Because String is an unconstrained array.
--
Visit the Ada 95 Booch Components Homepage: www.ocsystems.com/booch
This is not your father's Ada -- lglwww.epfl.ch/Ada
prev parent reply other threads:[~1996-04-24 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-21 0:00 Help with Text_IO Instantiation! Robert Gelb
1996-04-22 0:00 ` Robert Dewar
1996-04-24 0:00 ` John Herro
1996-04-24 0:00 ` David Weller [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox