From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9eb1b85372010e8 X-Google-Attributes: gid103376,public From: David Kirkland Subject: Re: private and limited private Date: 1996/10/10 Message-ID: <325D0EEF.431F@array.ca>#1/1 X-Deja-AN: 188501744 references: <53dfjn$1u@rc1.vub.ac.be> content-type: text/plain; charset=us-ascii organization: Array Systems Computing Inc. mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; SunOS 5.4 sun4m) Date: 1996-10-10T00:00:00+00:00 List-Id: AGBOH CHARLES wrote: > > Hi > > I would like to the know the difference between private and limited private > types. What is the criterion for choosing one as opposed to the other. > > Instantiation: what does this mean? > > Pardon me but I am learning Ada Say you declare a type as private. When I go to use that type I can freely use equality and assignment operators as well as any functions you create to let me manipulate that type. If you declare the type as limited private, I can no longer use the equality or asignment operators. I can only use the functions you export to let me manipulate the type. In Ada there are generic packages which do nothing by themselves. The generic packages let you specify the data types and also functions which the package will use when you instantiate it. An instantiation creates one instance of a generic package. Once you've instantiated it you can use it like any other package. A common application is , say a sorting algorithm. You could instantiate it once to create an integer sorting algorithm, and another instantiation to sort floats. Depending on how you design the generic you can also pass it the function to use to find out it one item is larger than another. This is great when you create a new data type and you want some special sorting algorithm - say alphabetically. Cheers, Dave