// Shapetst.cpp
//
// A main to drive Shape.h
// by Jeff Blessing, May 11, 1998

#include <iostream>
#include "Shape.h"
using namespace std;

void main()
{	static const int num_shapes = 3;
	Shape* shapes[num_shapes];

	cout << "Creating shapes ..." << endl;
	shapes[0] = new Circle(Point(1,3), 2);
	shapes[1] = new Line(Point(0,0), Point(3,4.5));
	shapes[2] = new FancyLine(Point(2,5), Point(3,6), FancyLine::DASHED);

	for (int i=0; i < num_shapes; i++)
		shapes[i]->draw();

	cout << "Test compiler object creation ..." << endl;
	FancyLine line1(Point(99,88), Point(-10,-2), FancyLine::DOTTED);
	line1.draw();
	FancyLine line2;
	line2.draw();

	cout << "Test default assignm't op. ..." << endl;
	line2 = line1;
	line2.draw();

	cout << "Test Shape container ..." << endl;
	ShapeList slist;
	ShapeListIter iter(slist);
	slist.add(new Line(Point(0,0), Point(2,3), 1));
	slist.add(new FancyLine(Point(1,1), Point(4,5)));
	slist.add(new Circle(Point(-3,-6), 2));

	cout << "Now iterate through the container ..." << endl;
	Shape* ptr;
	while ((ptr = *iter++) != NULL)	// default assign. operator!
		ptr->draw();
}