comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: private classes
Date: Sun, 03 Oct 2004 21:11:40 +0200
Date: 2004-10-03T21:15:06+02:00	[thread overview]
Message-ID: <87vfdrr503.fsf@insalien.org> (raw)
In-Reply-To: cjn5p0$f6v$03$1@news.t-online.com

"Rick Santa-Cruz" writes:
> Ok, I got it. The declaration of the procedure has to be before the "type 
> Derived_1 is new Base_1 with private;". Although I don't understand the 
> sense of this, but ok ;).

Dennis Lee Bieber already explained why in a previous post.  I think
his explanation is good and intuitive.  The technical term for this is
"freezing rules", defined formally in RM 13.14.  You might be
interested in reading that.  Note that few people actually bother to
really understand all the implications of freezing rules; they are of
interest primarily to compiler writers.

In your case, the declaration of type Derived_1 freezes type Base_1
(RM 13.14(7): "The declaration of a record extension causes freezing
of the parent subtype.").  After this point, no more primitive
subprograms ("methods") can be added to type Base_1.  This means that:

- you can declare procedure Proc (B : Base_1), but it is not a
  primitive subprogram, just a regular one.

- no dynamic dispatching can take place, since dynamic dispatching
  only involves primitive subprograms.

-- 
Ludovic Brenta.



  reply	other threads:[~2004-10-03 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-02 20:35 private classes Rick Santa-Cruz
2004-10-02 21:12 ` Rick Santa-Cruz
2004-10-03 19:11   ` Ludovic Brenta [this message]
2004-10-03 16:36 ` Martin Krischik
replies disabled

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