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,FILL_THIS_FORM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,2107bed9c7be998f,start X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-stoc.telia.net!news-stoa.telia.net!telia.net!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Persson?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114 X-Accept-Language: sv, en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Why can't I override these functions? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Message-ID: Date: Fri, 07 May 2004 10:43:51 GMT NNTP-Posting-Host: 217.209.116.179 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1083926631 217.209.116.179 (Fri, 07 May 2004 12:43:51 CEST) NNTP-Posting-Date: Fri, 07 May 2004 12:43:51 CEST Organization: Telia Internet Xref: controlnews3.google.com comp.lang.ada:358 Date: 2004-05-07T10:43:51+00:00 List-Id: I have a generic package with a tagged type Parameter_Definition, a=20 generic subpackage with a type Intermediate_Definition derived from=20 Parameter_Definition, and a generic child package with a type=20 Typed_Parameter_Definition derived from Intermediate_Definition. See the = code below. Gnat gives me an error on the declaration of=20 Typed_Parameter_Definition: extracted-discrete_parameters.ads:19:09: type must be declared abstract=20 or "Meaning" overridden But I *have* overridden that function! It's right there on line 23! If I = take Meaning away I get the same error saying that Default must be=20 overridden, which I have also done. I must be stupid because I can't see = why these functions don't count as overriding. Either that or the error=20 message is misleading and the error is really something else. Could=20 somebody please explain this? Here's the code. I have removed lots of stuff that doesn't affect the=20 error message: with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; generic type Parameter_Name is (<>); package Extracted is private type Parameter_Definition(mandatory, multiple : boolean) is abstract tagged record Description : Unbounded_String; end record; type Parameter_Definition_Pointer is access all=20 Parameter_Definition'class; type Value_Wrapper is tagged null record; type Value_Wrapper_Pointer is access all Value_Wrapper'class; function Meaning(Def : Parameter_Definition; Name : Parameter_Name; Text : Unbounded_String) return Value_Wrapper_Pointer is abstract; function Meaning_Valueless(Def : Parameter_Definition; Name : Parameter_Name) return Value_Wrapper_Pointer; function Default(Def : Parameter_Definition) return Value_Wrapper_Pointer is abstract; -- -- Common_Functions -- generic type Value_Type is private; type Array_Type is array(positive range <>) of Value_Type; type Wrapper_Type is new Value_Wrapper with private; with function Content(Wrapper : Wrapper_Type) return Value_Type; package Common_Functions is type Intermediate_Definition(mandatory, multiple : boolean) is abstract new Parameter_Definition(mandatory, multiple) with record= case mandatory is when false =3D> case multiple is when false =3D> Default : Value_Type; when true =3D> null; end case; when true =3D> null; end case; end record; end Common_Functions; end Extracted; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; generic type The_Type is (<>); package Extracted.Discrete_Parameters is type Vector is array(Positive range <>) of The_Type; private type Typed_Wrapper is new Value_Wrapper with record Value : The_Type; end record; function Content(Wrapper : Typed_Wrapper) return The_Type; package Funcs is new Common_Functions (The_Type, Vector, Typed_Wrapper, Content); -- This is line 18. Error on line 19 below. --------- type Typed_Parameter_Definition(mandatory, multiple : boolean) is new Funcs.Intermediate_Definition(mandatory, multiple) with null record; function Meaning(Def : Typed_Parameter_Definition; -- line 23 Name : Parameter_Name; Text : Unbounded_String) return Value_Wrapper_Pointer; function Default(Def : Typed_Parameter_Definition) return Value_Wrapper_Pointer; end Extracted.Discrete_Parameters; --=20 Bj=F6rn Persson jor ers @sv ge. b n_p son eri nu