Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
'function' : number overloads have no legal conversions for 'this' pointer
Remarks
The compiler could not convert this to any of the overloaded versions of the member function.
This error can be caused by invoking a non-const member function on a const object. Possible resolutions:
Remove the
constfrom the object declaration.Add
constto one of the member function overloads.
Example
The following example generates C2663:
// C2663.cpp
struct C {
void f() volatile {}
void f() {}
};
struct D {
void f() volatile;
void f() const {}
};
const C *pcc;
const D *pcd;
int main() {
pcc->f(); // C2663
pcd->f(); // OK
}