From e3e178f39f7d6781a7183d871d00b09caf0f9759 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 11 Jun 2009 20:47:35 +0200 Subject: adding dynamic_cast instead of typeid --- ue5/mean_mark.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ue5/mean_mark.hpp b/ue5/mean_mark.hpp index a28b219..e07aedc 100644 --- a/ue5/mean_mark.hpp +++ b/ue5/mean_mark.hpp @@ -2,6 +2,7 @@ #define MEAN_MARK_H #include +#include #undef SOLVED_3 #define SOLVED_3 @@ -29,9 +30,12 @@ namespace Ti unsigned count = 0; for(; first != last; ++first) { - if (typeid(*(*first)) != typeid(Student)) + /*if (typeid(*(*first)) != typeid(Student)) + continue;*/ + Student *s = dynamic_cast(&(*(*first))); + if (s == NULL) continue; - result += (*first)->mark(); + result += s->mark(); ++count; } return (count == 0) ? 0 : result / count; -- cgit v1.2.3