[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overloading



Felix Kollmann <fkollmann@gmx.net> writes:

> class foo_const
> {
> public:
>   void msg (string t1, string t2);
    ^^^^^^^
    virtual void msg (string t1, string t2);
       
You need to have it virtual to overload it.

> };

> void foo_const::msg (string t1, string t2)
> {
>   t1.append (t2);
> 
>   Foo.msg (t1);
       ^
Probably you want:

    foo_const::msg (t1);

to access the msg function of the parent class.

> }

-- 
                                                 http://pingus.seul.org | 
Ingo Ruhnke <grumbel@gmx.de>             http://home.pages.de/~grumbel/ |
------------------------------------------------------------------------+