%
%   >> t1 = Triang( 5, 10 );
%   >> t1 = t1.move( 1, -2 )
%   >> t1.draw
%   >> t1.print
%
classdef Triang < Shape
  properties 
    len = 0;
    wid = 0;
  end
    
  methods
    function obj = Triang(len,wid)
       obj@Shape(0,0); 
       obj.len = len;
       obj.wid = wid;
    end
    
    function draw( obj )
      x1 = obj.x; 
      x2 = obj.x + obj.len; 
      x3 = obj.x + obj.len/2; 
      y1 = obj.y; 
      y2 = obj.y + obj.wid;
           
      x = [x1,x2,x3,x1];
      y = [y1,y1,y2,y1];
      plot( x, y );           
    end
    
    function print( obj ) 
       fprintf( 'Triang: (len,wid) = (%g,%g) \n', obj.len, obj.wid ); 
       obj.print@Shape;  % Aufruf der Methode print von Shape 
    end
  end
end