I have a class and it has a member function and i want to call that member function in a non member function.
void mouseEvent(int evt, int x, int y, int flags, void* param);
class CMainClass
{
private:
// Xcoordinate of the click event
int Xcoordinate;
public:
// Xcoordinate get method
int CMainDialog::GetXcoordinate()
{
return Xcoordinate;
}
// Xcoordinate set method
void CMainDialog::SetXcoordinate(int newVal)
{
CMainDialog::Xcoordinate = newVal;
}
};
void mouseEvent(int evt, int x, int y, int flags, void* param)
{
CMainDialog::SetXcoordinate(x);
}
C++ a nonstatic member reference must be relative to a specific object
Aucun commentaire:
Enregistrer un commentaire