Yes... More compile errors...
sorry, removing the void from each line didn't help, I still get the same errors, i think removing the void was the first thing I ever tried... Oh, and yoou HAVE to make a game like that it would be so awesome... and educational! C++ n00bs could play and harden their knowledge of pointers, types, etc. It would be so great!
- Functions taking no parameters should be declared ReturnType Function();
- You need not declare a destructor in this particular case - the default destructor the compiler generates for you is enough.
- You may want to use an initializer list in your constructor definition, for efficiency. It's also a good habit to get into in general, since some members can only be initialized there.
- Your constructor creates Fish temporaries that are destroyed when your constructor exits. These should presumably be global or part of a GameData class (which might be passed to InitGameData's constructor.
- Or, a GameData class should simply init these members via its constructor.
Make the appropriate changes, then post back if you have any more questions.
- You need not declare a destructor in this particular case - the default destructor the compiler generates for you is enough.
- You may want to use an initializer list in your constructor definition, for efficiency. It's also a good habit to get into in general, since some members can only be initialized there.
- Your constructor creates Fish temporaries that are destroyed when your constructor exits. These should presumably be global or part of a GameData class (which might be passed to InitGameData's constructor.
- Or, a GameData class should simply init these members via its constructor.
Make the appropriate changes, then post back if you have any more questions.
Why on earth did I make an entire class to deal with initialising everything?!? It's not like I'm going to need to initialise it twice in two seperate classes?!? Would I just create a function in my main source file to initialise that stuff? Dammit I need to start thinking straight before I start typing.
I find it helps me to use a pen and paper and outline my design before I touch my keyboard.
edit:
If you want initialization to occur in GameData's constructor, all you need to do is create a GameData object, whether that be a global itself, or as a member in another class.
edit:
Quote:Would I just create a function in my main source file to initialise that stuff?
If you want initialization to occur in GameData's constructor, all you need to do is create a GameData object, whether that be a global itself, or as a member in another class.
If you are still having problems with the code, host the entire thing up or send it over to yaustar_8p[at]yahoo.co.uk.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement