#include #include "Shape.h" #include "TriangleRectangle.h" #include "Rectangle.h" int main() { Rectangle r(5, 10); TriangleRectangle t(1, 2); Shape* s[2] = {&r, &t}; std::cout << s[0]->area() << " " << s[0]->perimeter() << std::endl; std::cout << s[1]->area() << " " << s[1]->perimeter() << std::endl; std::cout << *s[0] << " area=" << s[0]->area() << ", perimeter=" << s[0]->perimeter() << std::endl; std::cout << *s[1] << " area=" << s[1]->area() << ", perimeter=" << s[1]->perimeter() << std::endl; return 0; } /* Sortie attendue : 50 30 1 5.23607 [Rectangle: width=5, height=10] area=50, perimeter=30 [RightTriangle: width=1, height=2] area=1, perimeter=5.23607 */