Added for cycle showing polymorphism
This commit is contained in:
parent
ff5b65d70a
commit
85e4dfa13d
7
main.c
7
main.c
|
@ -33,13 +33,16 @@ int main (int argc, char *argv[])
|
||||||
((Square *) fig[i])->vtable->diag_length (fig[i]));
|
((Square *) fig[i])->vtable->diag_length (fig[i]));
|
||||||
|
|
||||||
puts ("---\n");
|
puts ("---\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*goto end;
|
/*goto end;
|
||||||
err:
|
err:
|
||||||
end:*/
|
end:*/
|
||||||
fig[0]->vtable->destroy (fig[0]);
|
for (i = 0; i < sizeof (fig) / sizeof (Figure *); i++)
|
||||||
fig[1]->vtable->destroy (fig[1]);
|
{
|
||||||
|
fig[i]->vtable->destroy (fig[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue