object member variables.

C

claire.bell1

Hi,
Im making an othello game project and ive got to the point where the basic
game is done, but i need to add an intro and some way of deciding who you
play against.
My current structure is:
There is a main class othelloProgram which is created in the main method.
I want the othelloProgram to be in 3 main states, intro, game or newgame.
othelloProgram .: has an int variable state and the method SetState is
passed to the objects it creates.
To make a game an othelloProgram has 2 objects of type player and 1 of type
othelloGame, othelloGame's constructor needs to be passed pointers to the
players. othelloProgram also has an object of type intro.
Initially I do not want the othelloGame or players to be created, their
construction is dependant on the execution of the intro object, however the
constructor forces me to make them which causes all kinds of errors.
Also when intro eventually does run, i need to reconstruct the player and
othelloGame objects.

Is there any way to construct a class without constructing its member
objects? Also how do you destroy and remake an object from a member method?

Thanks for any help you can give,
Vipa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top