comp.lang.ada
 help / color / mirror / Atom feed
From: "Bernhard Rumpler" <b.rumpler@gmx.net>
Subject: problem with operation
Date: 1998/05/09
Date: 1998-05-09T00:00:00+00:00	[thread overview]
Message-ID: <01bc5cbd$c4565da0$LocalHost@default> (raw)


Hi!


I please help me with the following problem: (i'm a beginner)

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;
  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;  

Bernhard Rumpler <b.rumpler@gmx.net>





             reply	other threads:[~1998-05-09  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-09  0:00 Bernhard Rumpler [this message]
1998-05-09  0:00 ` problem with operation Matthew Heaney
1998-05-09  0:00 ` Michael F Brenner
1998-05-09  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox