comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Problem when overloading a procedure
Date: 1999/08/14
Date: 1999-08-14T00:00:00+00:00	[thread overview]
Message-ID: <K8kt3.5406$Rh.286109@typ11.nn.bcandid.com> (raw)
In-Reply-To: MPG.121fca311abf8d5b98999b@news.bcn.ttd.net


JIMHER@yanoesladirecci�n.com <vtis0102@CACANOps.uib.es> wrote in message
news:MPG.121fca311abf8d5b98999b@news.bcn.ttd.net...
> I'm writing a program, and I have found a problem when I try to overload
> a procedure. The program is:
>
> procedure program is
>
>    type MyType is array(1..10) of character;
>
>    procedure proc(s:in string) is
>    begin
>       put_line("Original string");
>    end proc;
>
>    procedure proc(s:in MyType) is
>    begin
>       put_line("My type");
>    end proc;
>
> begin
>    proc("hello");
> end program;
>
> The problem is that, when I compile the program, the compiler says that
> is unable to select between the two forms of 'proc'. I suppose that it is
> because the compiler can't decide if the literal "hello" is of type
> string or MyType, so I tried
>
> ...
> begin
>    proc(string("hello"));
> end program;
>
> but the compiler didn't accept it.
>
Your analysis was correct, and your solution was almost correct.
it should have been

proc(string'("hello"));

See RM 4.7









  reply	other threads:[~1999-08-14  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-14  0:00 Problem when overloading a procedure JIMHER@yanoesladirecci�n.com
1999-08-14  0:00 ` David C. Hoos, Sr. [this message]
1999-08-16  0:00 ` Robert Dewar
1999-08-17  0:00 ` Samuel T. Harris
1999-08-18  0:00   ` JIMHER@yanoesladirecci�n.com
replies disabled

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