Re: problem with multiple inheritance
Le mardi 16 août 2005 à 21:16:49, Tony Johansson a écrit dans
comp.lang.c++*:
[color=blue]
> Hello experts!
>
> I have a small program that is using multiple inheritance.
> There are 4 classes involved
> I get 4 compile error that I can't figure out why.
> It's this row which is located in the main program see below that is causing
> these compile errors.
> cout << p[i]->getName() << endl;[/color]
Actually, no, it's *this* line:
for(int i=0; i < p.size; i++)
[color=blue]
> Here is the first compile error the other might be a consequesce of the
> first one.
> c:\Documents and Settings\Tony\kau\cplusplus\test4\start.cpp(13): error
> C2446: '<' : no conversion from 'std::vector<_Ty>::size_type (__thiscall
> std::vector<_Ty>::* )(void) const' to 'int'
> with
> [
> _Ty=Person *
> ][/color]
You have a problem with the comparison: (error C2446: '<') because
you're comparing an int (i) with a function pointer (p.size). 'size' is
not a piece of data, but a function; you want this:
for (int i=0; i < p.size(); i++)
[color=blue]
>
> for(int i=0; i < p.size; i++)
> cout << p[i]->getName() << endl;[/color]
--
___________ 16/08/2005 21:29:42
_/ _ \_`_`_`_) Serge PACCALIN -- sp ad mailclub.net
\ \_L_) Il faut donc que les hommes commencent
-'(__) par n'être pas fanatiques pour mériter
_/___(_) la tolérance. -- Voltaire, 1763 |