Weird Inheritence Error

This is a discussion on Weird Inheritence Error within the C++ Programming forums, part of the General Programming Boards category; The error message I get is this. Code: C:\Programmingx\ClientCode\SplashManager.cpp(81) : error C2039: 'LoadMenuA' : is not a member of 'sGameMode' ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    411

    Weird Inheritence Error

    The error message I get is this.

    Code:
    C:\Programming\4x\ClientCode\SplashManager.cpp(81) : error C2039: 'LoadMenuA' : is not a member of 'sGameMode'
            c:\programming\4x\clientcode\mode.h(36) : see declaration of 'sGameMode'
    My code is gigantic, Ill just cut out the relavant parts to make this easy to read.

    Code:
    struct sShared {
    public:
    	sGameMode* mode;		
    };
    
    
    struct sGameMode {
    public:
    	sGameMode() {
    		mode = GAMEMODE_LOAD_SPLASH;
    	}
    	~sGameMode() {
    	}
    
    	//batch
    	void LoadSplash() {
    		mode = GAMEMODE_LOAD_SPLASH;
    	}
    	void LoadMenu() {
    		mode = GAMEMODE_LOAD_MENU;
    	}
    	void Quit() {
    		mode = GAMEMODE_QUIT;
    	}
    	void Exit() {
    		mode = GAMEMODE_EXIT;
    	}
    
    	//Only return a load mode one time, increment to the actual mode after
    	short GetMode() { 
    		short m = mode;
    		switch(mode) {
    		case GAMEMODE_LOAD_SPLASH:
    		case GAMEMODE_LOAD_MENU:
    			mode++;
    			break;
    		}
    		return m; 
    	}
    
    private:
    
    	short mode;
    };
    
    
    class cSplashManager : public sShared {
    public:
    	cSplashManager();
    	~cSplashManager();
    	void Process(float* rate);
    
    private:
    	//data structures
    	sSplash* current;
    
    	//fade functionality
    	bool fadein;
    	float accum;
    };
    
    void cSplashManager::Process(float* rate) {
    	//increment the accum value based on in our out
    	if(fadein) 
    		accum += *rate;
    	else 
    		accum -= *rate;
    
    	//check to see if we need to change direction
    	if(accum > 1.5f) 
    		fadein = false;
    
    	//check to see if we are done
    	else if(accum < -0.25f)
    		mode->LoadMenu();  //COMPILER ERROR HERE
    
    	//set the current color based on this value
    	current->color->SetA(accum);
    }

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,318
    Try changing the name of LoadMenu to something completely unique (like GameModeLoadMenu123). Make sure to update that name everywhere you use it.

    The error reference to LoadMenuA makes me think that a Windows typedef or #define is conflicting with your method names.

    If that doesn't work, then try to make a small, compilable example that demonstrates the problem.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    411
    Thats what it was, damn annoying I tell you. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 03:35 PM
  2. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  5. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21