#include <iostream>
#include <vector>
using namespace std;

#include "Shape.cpp"
#include "Rectangle.cpp"
#include "Circle.cpp"

int main(){

	//shape object
	Shape s(0,0);
	//object of the above (abstract) class cannot be created
	cout <<"The area of the shape is" <<s.area;


	Shape *shape;//pointer
	Rectangle *rectangle;//pointer
	rectangle = new rectangle(1,1,1,1);

	shape = rectangle;
	//the following is the wrong way 
	// rectangle = shape; //because not  all dhapes are rectangles

	cout<< "rectangle width:" << rectangle->getwidth() <<endl;
	//cout <<"rectangle width:" << shape->getWidth() <<endl; //this is wrong, it is also known as The Slicing problem, because the shape is a pure virtual class

	
	//1x1 rectangle at(0,0)
	Rectangle r(0,0,1,1);

	//Unit circle at (0,0)
	Circle c(0,0,1);

	r.print();
	cout<<"Rectangle's area:" << r.area() <<endl;
	cout<< "Rectangle is "<< (r.empty() ?"":"not") <<" empty" <<endl;

	c.print();
	cout <<"Circle's area:" << c.area() <<endl;
	cout <<"Circle is "<< (c.empty() ?"":"not") <<" empty" <<endl;




	//Polymorphic Values
	//all polymorphic values must be pointers, otherwise they won't work
	vector<Shape*> shapes;
	shapes.push_back(&r);
	shapes.push_back(&c);
	shapes.push_back(rectangle);

	double totalArea=0;
	for (i=0; i<shapes.size(); i++){
		shapes[i]->print();
		totalArea += shape[i]->area();/	}
	cout <<"Total area of all shapes is: " << totalArea <<endl;


	//there is no polymorphism here, we use variables, not pointers
//	vector<Shape> vShapes;
//	vShapes.push_back(r);
//	vShapes.push_back(c);
//	vShapes.push_back(rectangle);
//	for (int i=0; i<vShapes.size(); i++){
//		vShapes[i].print(); //print called from Shape
//		vShapes[i].area(); //area called from shape => abort !!
//	}

	

return 0;
}
