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,e7f93d8ad6f20c52 X-Google-Attributes: gid103376,public From: matthew_heaney@acm.org (Matthew Heaney) Subject: Re: problem with operation Date: 1998/05/09 Message-ID: #1/1 X-Deja-AN: 351814318 Content-Transfer-Encoding: 8bit References: <01bc5cbd$c4565da0$LocalHost@default> Content-Type: text/plain; charset=ISO-8859-1 Organization: Network Intensive Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-05-09T00:00:00+00:00 List-Id: In article <01bc5cbd$c4565da0$LocalHost@default>, "Bernhard Rumpler" wrote: (start of quote) I don't know how to use the operation "+" with a private type. ("left operand has private type "Element_Typ" defined at Matrizen_Operationen.ads, right operand has.." ..the same type) I simply want to add the Operands as if they were of type Integer, real or sth. like that. GENERIC TYPE Element_Typ IS PRIVATE; (end of quote) Here is your problem. You haven't imported addition of elements as a operation. So do this: with function "+" (L, R : Element_Type) return Element_Type is <>; (start of quote) Z_S_Zahl : NATURAL; PACKAGE Matrizen_Operationen IS TYPE Matrix IS PRIVATE; FUNCTION "+" (M1,M2: IN Matrix)RETURN Matrix; FUNCTION "*" (M1,M2: IN Matrix)RETURN Matrix; PRIVATE TYPE Matrix IS ARRAY (1..Z_S_Zahl, 1..Z_S_Zahl)OF Element_Typ; END Matrizen_Operationen; PACKAGE BODY Matrizen_Operationen IS FUNCTION "+" (M1,M2: IN Matrix) RETURN Matrix IS i,j: INTEGER; M3: Matrix; BEGIN FOR i IN 1..Z_S_Zahl LOOP FOR j IN 1..Z_S_Zahl LOOP M3(i,j) := M1(i,j)+M2(i,j); -- <-- HERE!!!! END LOOP; END LOOP; RETURN M3; END; FUNCTION "*" (M1,M2: IN Matrix) RETURN Matrix IS M3: Matrix; BEGIN RETURN M3; END; END Matrizen_Operationen; (end of quote)