I'm assuming that's what this is...
I'm working on a fairly large software package. I was basically handed it and told "figure this out." It's actually fairly fun most of the time.
Of course I wouldn't have been handed it if it didn't have problems. I've managed to fix all of the compile errors except one... and it's been giving me hell.
I'll try to summarize it as best I can. I can't reprint any of the actual code because it's proprietary.
The compile error:
The function it's talking about is this:Code:Error 9 error C2509: 'Initialize' : member function not declared in 'ScObj'
OK, that seems simple enough. Clearly the ScObj class (or one of its parents) is supposed to have an Initialize() declaration, and for some reason it's not there.Code:void ScObj::Initialize() { //DOES STUFF. }
I do some hunting. There's a long inheritance chain involved here.
ok, so ScObj inherits from NetObj, right? I'm not being stupid here and missing something am I?Code:class ScObj : public NetObj { //CLASS STUFF, NO MENTION OF Initialize() }
It goes on:
Code:class NetObj : public SimObj { //CLASS STUFF }Code:class SimObj : public ConObj { //CLASS STUFF }YES! I've traced down where Initialize is supposed to have come from! (interestingly, the definition for ConObj::Initialize() is empty - no code at all. Must be defined differently for all member functions... but then shouldn't it be virtual?)Code:class ConObj : public SimCom { //FINALLY, HERE'S Initialize()!!!! public: static void Initialize(); }
Only problem is... you can tell by the compile error that the child class can't see it. Why not?? Everything in the whole chain is public. My understanding is that every method of every parent should be accessible by every child.
The actual inheritance tree is fairly complex, with lots of branching that I've left out. Here is a list of things I've tried and most of which had disastrous consequences (that is to say, my error count went from 2 up to 200 or more in most of them):
#included the file which contains ConObj into the beginning of the file with the ScObj class.
Made ConObj a friend of ScObj.
Inserted a new void Initialize() function into ScObj.
Changed the declaration of Initialize in ConObj from static to virtual. (BAD IDEA)
Commented out the problem function (BAD IDEA).
So any ideas here? What am I missing? Lots of other classes seem to call Initialize() without any problems.![]()


LinkBack URL
About LinkBacks




Reply With Quote







Bookmarks