|
-
October 2nd, 2002, 09:19 AM
#1
Why is my member function static?
In a member function, I get the (in VC) error:
error C2352: 'CSomeOtherClass::SomeMemberFunction' : illegal call of non-static member function
Upon investigation, it appears the member function of my class is static for some reason, and that 'CSomeOtherClass::SomeMemberFunction' (member function of the other class) is not, thus the error, which is fine.
However, I don't even have the "static" keyword in my own class definition anywhere, and checking all the ancestors (about 8), none of them have my function defined, so I know it isn't an override inheriting some static somewhere. (I even added an x to the name to make sure.)
What possibilities am I looking for that would make my member function static? It isn't some compiler option since a dummy class I created had no problem calling that other function, meaning the dummy class was created non-static, as expected.
To sum up (pseudocode):
class MyClass : InheritingClass {
MyMemberFunction();
}
MyClass::MyMemberFunction()
{
CSomeOtherClass::SomeMemberFunction(); // Generates error
}
Note that I am calling CSomeOtherClass::SomeMemberFunction() and not someVariable->SomeMemberFunction().
That function is declared virtual (not pure) and may or may not be overridden, but it definitely exists in CSomeOtherClass.
So, is it generating the error because I am trying to directly call a virtual function (even if defined in that base class?) or is it something else still?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|