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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9a546f4f1f8aff6,start X-Google-Attributes: gid103376,public From: pruiz@SIRIO.DIT.UPM.ES Subject: (no subject given) Date: 1996/02/21 Message-ID: <199602211831.TAA01734@vega.gic.tat.upm.es>#1/1 X-Deja-AN: 140466332 sender: Ada programming language comments: Gated by NETNEWS@AUVM.AMERICAN.EDU newsgroups: comp.lang.ada Date: 1996-02-21T00:00:00+00:00 List-Id: I would like to know why the gnat sends the message : "type (Unit) must be declared abstract or Set (procedure) overrides" when I'm compiling the package body "Controller-p.adb";the error is detected in the specification, i.e., in "Controller-p.ads". Package Controller is abstract and generic; Package Controller.P is his child :it isn't Abstract!!! but is generic; I supposed when I writted it, that Set overrides, but this is not a problem, is it ??? This is the usual when we are working with abstract types and subpro- grams, isn't it??? This is my conclusion reading the last Barnes' book. Next, I send the packages. Thank you very much!!!!. ******************************************************************************* generic -- package Controller,it is abstract. type Controlled_Variable is delta <>; type Actuating_Variable is delta <>; package Controller is -- generic type Unit is abstract tagged private; subtype Class is Unit'Class; procedure Set (Device : in out Unit) is abstract; procedure Control (Device : in out Unit; Reference : in Controlled_Variable; Measurement : in Controlled_Variable; Action : out Actuating_Variable) is abstract; private type Unit is tagged null record; end Controller; -- /************************************************************************** generic -- package Controller.P type Parameter is delta <>; -- generic parameter package Controller.P is -- generic type Proportional_Controller is new Unit with private; private type Proportional_Controller is new Unit with record Gain : Parameter; end record; procedure Set (Device : in out Proportional_Controller; Gain : in Parameter); procedure Control (Device : in out Proportional_Controller; Reference : in Controlled_Variable; Measurement : in Controlled_Variable; Action : out Actuating_Variable); end Controller.P; -- /********************************************************************** -- / Controller.P -- /************************************************************************** package body Controller.P is -- generic procedure Set (Device : in out Proportional_Controller; Gain : in Parameter) is begin Device.Gain := Gain; end Set; procedure Control (Device : in out Proportional_Controller; Reference : in Controlled_Variable; Measurement : in Controlled_Variable; Action : out Actuating_Variable) is Error : Controlled_Variable; begin Error := Reference - Measurement; Action := Device.Gain * Error; end Control; end Controller.P; -- ***************************************************************************