Aug 20, 2021 at 3:22pm
GUI.cc
|
SomeClass::Dothing(); //A nonstatic member reference must be relative to a specific object
|
SomeClass.cpp
1 2 3 4 5 6
|
class SomeClass
{
public:
void Dothing(); //This is what I want to use.
}
|
Last edited on Aug 20, 2021 at 3:24pm
Aug 20, 2021 at 3:30pm
First, minor terminology critique: You don't call 'void', you call a
function (which happens to have a return type of void).
If a class member function is not static, you need an instance of that class (an object), for the function be called on.
1 2 3 4 5
|
int main()
{
SomeClass somebody;
somebody.Dothing();
}
|
Otherwise, make the function static.
1 2 3 4 5
|
class SomeClass
{
public:
static void Dothing();
};
|
Last edited on Aug 20, 2021 at 3:45pm