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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,899484222880ae7c X-Google-Attributes: gid103376,public From: "Norman H. Cohen" Subject: Re: preventing inheritance Date: 1996/12/18 Message-ID: <32B834AC.409@watson.ibm.com>#1/1 X-Deja-AN: 204768830 references: <32B22CDC.3FE4@bix.com> <32B5A234.947@watson.ibm.com> <32B640FC.D30@bix.com> <32B64298.3CC5@bix.com> content-type: text/plain; charset=us-ascii organization: IBM Thomas J. Watson Research Center mime-version: 1.0 reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win95; I) Date: 1996-12-18T00:00:00+00:00 List-Id: 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