GradeBook::Grade
is a non-static member function, it needs to operate on an instance of GradeBook
. You can’t pass it in to a function expecting a plain function pointer.
You could change TESTobj::SET
to accept std::function
objects, then wrap your member function in a lambda:
void TESTobj::SET(std::function<void()> nu)
void GradeBook::Set()
{
OBJ.SET([this](){Grade();});
OBJ.Test();
}
solved C++ Using Object with pass function [closed]