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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7a8e90e9b8a62d13 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-09 21:19:33 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!sgigate.sgi.com!enews.sgi.com!lll-winken.llnl.gov!uwm.edu!vixen.cso.uiuc.edu!sdd.hp.com!hplabs!hplextra!news.dtc.hp.com!col.hp.com!jimr From: jimr@col.hp.com (Jim Rogers) Newsgroups: comp.lang.ada Subject: Re: Please explain why this is wrong... Date: 10 Feb 1995 05:19:33 GMT Organization: HP Colorado Springs Division Message-ID: <3het15$nn7@nonews.col.hp.com> References: <3h8u4s$ea3@nonews.col.hp.com> <3hc3n3$onc@gnat.cs.nyu.edu> NNTP-Posting-Host: hpsqe4.col.hp.com X-Newsreader: TIN [version 1.2 PL2] Date: 1995-02-10T05:19:33+00:00 List-Id: Robert Dewar (dewar@cs.nyu.edu) wrote: : Your program is clearly wrong, and the message from GNAT is quite precise. Yes, you are correct. I have learned, thanks to the kind expalnations from Mssrs Dewar and Nebbe, esxactly how my thinking erred. : You have a primitive operation New_Square, which is inherited when you : make a rectangle to give a function New_Square that returns a Rectangle. This is precisely what I overlooked. I was attempting to translate a rather trivial C++ inheritence example into Ada. I ignored (and was ignorant of) the inherited constructor. :............ : If as I suspect, you really did not intend New_Square to be inherited, but : rather intended it to serve as a constructor only for the Square case, then : you must be sure that you do not declare in as being primitive. The easiest : way to declare non-primitive operations is to nest them in a subpackages; : package Constructors is : function New_Square .. return Square; : end Constructors; This solution was so simple and obvious that I would probably have missed it for quite a while. As you have already guessed, I am sure, I am not exactly an Ada wizard....yet. I hope this thread has served as a good example of the problems explained by Tucker Taft concerning Ada constructors in this same news group. Thank you all. I have learned yet again why I prefer Ada to C++. -- ------------------------------------------------------------------------------ | Jim Rogers | Dead Reckoning: | | Hewlett-Packard Company | Traditional form of rough-estimate | | Colorado Springs Division | navigation used for hundreds of years by | | | sailors, almost all of whom are dead. | | jimr@col.hp.com | | ------------------------------------------------------------------------------