-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
29 lines (26 loc) · 921 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include "car.h"
#include "motorcycle.h"
int main(void)
{
auto polito = construct_car("Polito");
auto verde = construct_motorcycle("Verde");
auto rojo = construct_motorcycle("Rojo");
terrestrial *vehicles[] = {
(terrestrial *)&polito,
(terrestrial *)&verde,
(terrestrial *)&rojo,
};
for (int i = 0; i < sizeof(vehicles) / sizeof(struct vehicle *); i++) {
terrestrial *v = vehicles[i];
printf(
"Common name: %s\n"
"Particular name: %s\n"
"Number of wheels: %d\n"
"\n",
(v)->class->get_common_name(v),
(v)->class->get_particular_name(v),
(v)->class->get_number_of_wheels(v)
);
}
}