Example #1
0
int main () 
{
  Figure r {4, 7};
  std::cout << "Rectangle Area: " << r.area() << std::endl;
  Figure c {1};
  std::cout << "Circle Area: " << c.area() << std::endl;
  return 0;
}
Example #2
0
int main(int argc, char ** argv)
{
	Figure* f = new Square(Point(10.0, 20.0), 30.0);
	Figure* g = new Point(-5.0, 15.0);

	cout << *f << " ma pole " << f->area() << endl;
	cout << *g << " ma pole " << g->area() << endl;

	// Napisz klasy Circle i Line powyżej tak, by poniższy kod się kompilował

	
	Figure* c = new Circle(Point(40.0, 50.0), 5.0);
	c -> translate(10.0, 5.0);
	c -> rotate(0.5);
	cout << *c << endl;
	
	Figure* l = new Line(Point(5.0, 7.0), Point(3.0, 2.0));
	l -> rotate(-0.2);
	l -> translate(3.0, 5.0);
	cout << *l << endl;
}