comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada 2005 OOP : newbie questions
Date: Thu, 27 Jan 2011 16:15:20 +0100
Date: 2011-01-27T16:15:25+01:00	[thread overview]
Message-ID: <rahmct77kd97$.1st3durl551z$.dlg@40tude.net> (raw)
In-Reply-To: C9673789.51E3%news@findlayw.plus.com

On Thu, 27 Jan 2011 14:54:01 +0000, Bill Findlay wrote:

> I have a package P that declares
> 
>    type R is new Limited_Controlled with private;
> 
> The private extension of R contains a number of fields that I want to be
> common to future derived types S, T, etc; P declares a number of primitive
> operation signatures of R that I want S, T, etc, to override; and there are
> some operations on R'Class in P as well.
> 
> 1. Can I prevent objects of type P.R from being declared,
>    while allowing objects of types S, T, etc?

A type with no instances is abstract:

   type R is abstract new Limited_Controlled with private;

> 2. Can I prevent a useless primitive of P.R, say P.Op from being called?

Useless in which sense? If the operation cannot be implemented in R, it
should be abstract to be implemented in S and T.

   procedure Foo (Object : in out R) is abstract;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2011-01-27 15:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 14:54 Ada 2005 OOP : newbie questions Bill Findlay
2011-01-27 15:15 ` Dmitry A. Kazakov [this message]
2011-01-27 15:50   ` Bill Findlay
replies disabled

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