Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange error c2660 "function does not take 1 arguments"

My base class has this function

LRESULT CBaseClass::OnTestFunction(WPARAM id, LPARAM=0)
{
...
}

When the derived class calls this function

OnTestFunction(nId);

I get an error C2660 : "function does not take 1 arguments".

Why is that ?

like image 409
Wartin Avatar asked Jun 27 '26 07:06

Wartin


2 Answers

You need to put the default value in the class definition in the header file.

class CBaseClass {
    ....
    LRESULT OnTestFunction(WPARAM id, LPARAM=0);
    ....
};
like image 52
unquiet mind Avatar answered Jun 28 '26 20:06

unquiet mind


The default value should be in the class definition:

class CBaseClass {
    LRESULT OnTestFunction(WPARAM id, LPARAM=0);
};

so that the derived class can see that signature and the default value.

like image 36
sharptooth Avatar answered Jun 28 '26 19:06

sharptooth