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-08 21:11:07 PST Path: swrinde!gatech!udel!news.mathworks.com!panix!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Please explain why this is wrong... Date: 8 Feb 1995 22:55:15 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3hc3n3$onc@gnat.cs.nyu.edu> References: <3h8u4s$ea3@nonews.col.hp.com> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1995-02-08T22:55:15-05:00 List-Id: Your program is clearly wrong, and the message from GNAT is quite precise. 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. Now it is not clear why you made this a primitive operation. I rather suspect that you expect to use New_Square only for a Square, in which case it should NOT be primitive. If indeed you intend it to be inherited, it MUST be overridden. The reason for this rule is simple. In the general case the derivation involves extending the type, and how could the original function code possibly know enough to initialize the extension -- it couldn't. 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;