Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"error: no matching function for call to " when overloading method of base class

0 views
Skip to first unread message

Sven

unread,
Jan 28, 2009, 8:56:28 AM1/28/09
to
Hi,

I cannot see which problem the compiler (g++ 4.1.2) has with my code.
Is says to me:
../poollist.cc:480: error: no matching function for call to
‘TPoolList::Append(char*)’
../poollist.cc:367: note: candidates are: void TPoolList::Append
(PoolEntryKey_t&)

And this is the related part of the code:

class TList : public TWindow {
public:
void Append( char* );
// ...
};

class TScrolledList : public TList {
// ...
};

class TPoolList : public TScrolledList {
public:
void Append( PoolEntryKEy_t& );
// ...
};

TPoolList* poolList = new TPoolList;
poolList->Append( "text" );

Can someone tell me, what the problem might be? Why is the method of
the base class invisible there?

Thanks, Sven

Victor Bazarov

unread,
Jan 28, 2009, 9:20:07 AM1/28/09
to

Read about *name hiding*. Probably in the FAQ.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

Old Wolf

unread,
Jan 28, 2009, 5:13:59 PM1/28/09
to
On Jan 29, 2:56 am, Sven <s...@ast.dfs.de> wrote:
> ../poollist.cc:480: error: no matching function for call to
> ‘TPoolList::Append(char*)’
> ../poollist.cc:367: note: candidates are: void TPoolList::Append
> (PoolEntryKey_t&)
>
>
> class  TPoolList : public TScrolledList {
> public:
>   void Append( PoolEntryKEy_t& );

http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9

(except that the FAQ example has versions of Append
that both match the parameter, so the wrong one is
silently called; at least in your example you get a
compiler error).

0 new messages