Funktionen: Chain chain.cc

#include "chain.h"

Chain::Chain(const Circle& c1, 
             const Circle& c2) : Circle(c1)
{
  c=Circle((Point&) c2, getRadius());
}

Chain::Chain(const Point& p1, const Point& p2, 
             const int r) : Circle(p1, r)
{
  c=Circle(p2, r);
}

float Chain::area()
{
  return (Circle::area()+(distance(c)*2*getRadius()));
}

float Chain::perimeter()
{
  return (Circle::perimeter() + 2*distance(c));
}

ostream& operator<<(ostream& s, Chain& ch)
{
  return s << "{" << (Point&) ch << ","
           << (Circle &) ch.c << "}";
}

previous up next


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