From: Georg Bauhaus <bauhaus@arcor.de>
Subject: Re: how to import a package
Date: Mon, 11 Dec 2006 10:40:06 +0100
Date: 2006-12-11T10:39:22+01:00 [thread overview]
Message-ID: <1165830005.15844.5.camel@localhost> (raw)
In-Reply-To: <1165819804.449958.305980@73g2000cwn.googlegroups.com>
On Sun, 2006-12-10 at 22:50 -0800, markww wrote:
> So I made a test function like:
>
> procedure Add_Record(GenericData : gNode.T) is
> Temp : gNode.Node_Ptr;
> begin
> Temp := new gNode.Node;
> Temp.Data := GenericData;
> end Add_Record;
>
> now the compiler is saying that my generic type T is not visible to the
> rest of the application.
The type T is in the formal part of the package, not in the package
proper. So either you are explicit about T (you have made an
instance of the package using Some_Type for T, so you can use
Some_Type instead of gNode.T there, too) or you make your generic
package have a type Gen_T by using "subtype Gen_T is T" or similar.
> Also, is this procedure definition correct? In C++ it's easy to do this
> after defining a type it would be just:
>
> bool Add_Record (T t);
> template<typename T>
> bool CLinkedList<T>::Add_Record(T t)
> {
> // ...
> }
But here, you have one specific T and one generic T.
next prev parent reply other threads:[~2006-12-11 9:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 2:14 how to import a package markww
2006-12-06 3:06 ` Adam Beneschan
2006-12-06 3:34 ` markww
2006-12-06 9:18 ` Simon Wright
2006-12-06 19:47 ` Jeffrey R. Carter
2006-12-06 23:56 ` markww
2006-12-07 1:18 ` Björn Persson
2006-12-07 1:26 ` Brian May
2006-12-07 4:14 ` markww
2006-12-07 4:40 ` Brian May
2006-12-07 9:32 ` Stuart
2006-12-07 11:21 ` Jean-Pierre Rosen
2006-12-11 6:16 ` markww
2006-12-11 6:50 ` markww
2006-12-11 9:40 ` Georg Bauhaus [this message]
2006-12-11 14:19 ` markww
2006-12-11 15:03 ` Dmitry A. Kazakov
2006-12-11 16:22 ` Adam Beneschan
2006-12-11 20:28 ` Jeffrey R. Carter
2006-12-12 3:19 ` markww
2006-12-12 3:31 ` Jeffrey R. Carter
2006-12-12 9:03 ` Stuart
2006-12-12 10:56 ` Georg Bauhaus
2006-12-11 7:00 ` Simon Wright
2006-12-07 4:06 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox