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