Class Chain-Header rect.cc

#include "rect.h"

OrtRect::OrtRect(int width, int height)
{
  right.assign(width, height);
}

OrtRect::OrtRect(const Point& s, const Point& p)
{
  left=s; right=p;
}

int OrtRect::area()
{
  return((right.x-left.x)*(right.y-left.y));
}

int OrtRect::perimeter()
{
  return(2*(right.x-left.x)*(right.y-left.y));
}

ostream& operator<<(ostream& s, OrtRect& r)
{
  return s << "[" << r.left 
           << ", " << r.right << "]";
}

previous up next


© 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 12/16/1998