CS2263/Final/FinalCode/polymorphism/polymorphism.c

14 lines
345 B
C
Raw Normal View History

2023-05-22 23:28:51 -03:00
#include <stdio.h>
#include "triangle.h"
#include "square.h"
#include "shape.h"
int main(){
Shape *triangle = newTriangle(20);
Shape *square = newSquare(20);
printf("Triangle area of perimeter 20: %f\n", triangle->area(triangle));
printf("Square area of perimeter 20: %f\n", square->area(square));
return 0;
}