Added for cycle showing polymorphism

This commit is contained in:
Kolan Sh 2012-04-30 19:32:41 +04:00
parent ff5b65d70a
commit 85e4dfa13d
1 changed files with 5 additions and 2 deletions

7
main.c
View File

@ -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;
} }