From 85e4dfa13d67fcbc33a0769839195b26186a63bd Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 30 Apr 2012 19:32:41 +0400 Subject: [PATCH] Added for cycle showing polymorphism --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 521ab94..d13fee5 100644 --- a/main.c +++ b/main.c @@ -33,13 +33,16 @@ int main (int argc, char *argv[]) ((Square *) fig[i])->vtable->diag_length (fig[i])); puts ("---\n"); + } /*goto end; err: end:*/ - fig[0]->vtable->destroy (fig[0]); - fig[1]->vtable->destroy (fig[1]); + for (i = 0; i < sizeof (fig) / sizeof (Figure *); i++) + { + fig[i]->vtable->destroy (fig[i]); + } return 0; }