comp.lang.ada
 help / color / mirror / Atom feed
From: "Norman H. Cohen" <ncohen@watson.ibm.com>
Subject: Re: preventing inheritance
Date: 1996/12/18
Date: 1996-12-18T00:00:00+00:00	[thread overview]
Message-ID: <32B834AC.409@watson.ibm.com> (raw)
In-Reply-To: 32B64298.3CC5@bix.com


Tom Moran wrote:
> 
> The real problem is that U really 'is a' T, it's just that MS does not
> give a way to implement a particular operation on objects of type U.
> It is not satisfying to simply say 'well, I guess U's aren't T's after
> all'.

A simple tautology:

 - A multiline edit control is an edit control.

 - A multiline edit control does not have a Get_First_Character
operation.

 - Therefore there exist edit controls that do not have
Get_First_Character operations.

In other words, Get_First_Character should not be an operation of edit
controls.

My original suggestion--

   package Edit_Controls is
      type Edit_Control_Type is abstract tagged private;
      -- various operations common to all edit controls
      ...
   end Edit_Controls;

   package Edit_Controls.Single_Line is
      type Single_Line_Edit_Control_Type is 
         new Edit_Control_Type with private;
      procedure Get_First_Character
         (Control : in out Single_Line_Edit_Control_Type;
          Item    : out Character);
   private
      type Single_Line_Edit_Control_Type is
         new Edit_Control_Type with null record;
   end Edit_Controls.Single_Line;

   package Edit_Controls.Multiline is
      type Multiline_Edit_Control_Type is 
         new Edit_Control_Type with private;
      ...
   end Edit_Controls.Multiline;

--still strikes me as a perfectly natural way to model this problem
domain.  Why do you think this looks "bizarre"?

-- 
Norman H. Cohen
mailto:ncohen@watson.ibm.com
http://www.research.ibm.com/people/n/ncohen




  parent reply	other threads:[~1996-12-18  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-13  0:00 preventing inheritance Tom Moran
1996-12-16  0:00 ` Norman H. Cohen
1996-12-16  0:00   ` Tom Moran
1996-12-16  0:00     ` Tom Moran
1996-12-17  0:00       ` Larry Kilgallen
1996-12-18  0:00       ` Norman H. Cohen [this message]
1996-12-18  0:00         ` Tom Moran
1996-12-19  0:00     ` Robert I. Eachus
replies disabled

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