comp.lang.ada
 help / color / mirror / Atom feed
* problem with operation
@ 1998-05-09  0:00 Bernhard Rumpler
  1998-05-09  0:00 ` Michael F Brenner
  1998-05-09  0:00 ` Matthew Heaney
  0 siblings, 2 replies; 4+ messages in thread
From: Bernhard Rumpler @ 1998-05-09  0:00 UTC (permalink / 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>





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-05-09  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-09  0:00 problem with operation Bernhard Rumpler
1998-05-09  0:00 ` Michael F Brenner
1998-05-09  0:00   ` Robert Dewar
1998-05-09  0:00 ` Matthew Heaney

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