comp.lang.ada
 help / color / mirror / Atom feed
* PRIVATE abstract data type in ADS
@ 2002-10-25 21:52 Dominic D'Apice
  2002-10-26  9:11 ` Pascal Obry
  2002-10-30 13:24 ` John English
  0 siblings, 2 replies; 3+ messages in thread
From: Dominic D'Apice @ 2002-10-25 21:52 UTC (permalink / raw)



Hi, in this abstract data type in ADS (see below), do i need to put 

"type louer is access reservation" with the "IS PRIVATE" ?

If no, why i don't need to put "IS PRIVATE" after a access type when i
want to keep it PRIVATE ?


ADS
---

Package reservation   is

type auto_res IS PRIVATE	
	
type reservation IS PRIVATE;
type louer       is access reservation ;

type tete_liste_louer IS PRIVATE;
type liste_louer is access tete_liste_louer ;

...

PRIVATE

type auto_res is (econo,moyenne,grande,familliale,sport,limousine);

type reservation is record
	num       : natural := 0;

	plancher  : integer := 20;
	plafond   : integer := 20;
	classe    : auto_res := econo;
	nomclient : string(1..256);
	suivant   : louer := null;
end record;


type tete_liste_louer is record
	premier  : louer := null;
	dernier  : louer := null;
	longueur : natural    := 0;			
end record;






Thanks / merci
Dominic




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PRIVATE abstract data type in ADS
  2002-10-25 21:52 PRIVATE abstract data type in ADS Dominic D'Apice
@ 2002-10-26  9:11 ` Pascal Obry
  2002-10-30 13:24 ` John English
  1 sibling, 0 replies; 3+ messages in thread
From: Pascal Obry @ 2002-10-26  9:11 UTC (permalink / raw)



"Dominic D'Apice" <dapiced@sympatico.ca> writes:

> Hi, in this abstract data type in ADS (see below), do i need to put 
> 
> "type louer is access reservation" with the "IS PRIVATE" ?
> 
> If no, why i don't need to put "IS PRIVATE" after a access type when i
> want to keep it PRIVATE ?

Because there is nothing to hide with the access type. You just have exposed
the name and no field is accessible via the access type (except in
reservation's body of course !).

So I really don't see the problem here... or maybe I missed your point :)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PRIVATE abstract data type in ADS
  2002-10-25 21:52 PRIVATE abstract data type in ADS Dominic D'Apice
  2002-10-26  9:11 ` Pascal Obry
@ 2002-10-30 13:24 ` John English
  1 sibling, 0 replies; 3+ messages in thread
From: John English @ 2002-10-30 13:24 UTC (permalink / raw)


Dominic D'Apice wrote:
> 
> Hi, in this abstract data type in ADS (see below), do i need to put
> 
> "type louer is access reservation" with the "IS PRIVATE" ?
> 
> If no, why i don't need to put "IS PRIVATE" after a access type when i
> want to keep it PRIVATE ?

If you had "type Lower is private" in the visible part of the package,
the only things you could do with a Lower are assignment and equality
testing (plus operations involving Lower defined in the visible part
of the package). You couldn't do any of these things:
  L : Lower := new Reservation;
  R : Reservation := L.all;
If you want package clients to be able to do this sort of thing, Lower
has to be visibly an access type. So in the end, it's up to you to
decide what you want to allow your clients to do with Lower objects...

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-30 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-25 21:52 PRIVATE abstract data type in ADS Dominic D'Apice
2002-10-26  9:11 ` Pascal Obry
2002-10-30 13:24 ` John English

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