24 lines
616 B
C++
24 lines
616 B
C++
|
//
|
||
|
// Created by Marcus Vinicius de Carvalho
|
||
|
//
|
||
|
|
||
|
#include "main.h"
|
||
|
#include <iostream>
|
||
|
|
||
|
class TestPolygon {
|
||
|
public:
|
||
|
static void printArea(Polygon& poly) {
|
||
|
const float area = poly.calculateArea();
|
||
|
cout << "The area of the " << StringKindofPolygon[poly.getPolytype()] << " is " << area << endl;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
int main(int argc, const char * argv[]) {
|
||
|
Rectangle rectangle1("Rectangle1", 3.0f, 4.0f);
|
||
|
rectangle1.printWidthHeight();
|
||
|
TestPolygon::printArea(rectangle1);
|
||
|
|
||
|
Triangle triangle1("Triangle1", 3.0f, 4.0f);
|
||
|
triangle1.printWidthHeight();
|
||
|
TestPolygon::printArea(triangle1);
|
||
|
}
|