Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Programming help needed
#6
Okay, there are 8 booleans and 1 char.

So you need to have a few objects:

A minivan object which HAS A:
- driver door (Door class)
- passenger door (Door class)
- left sliding door (Sidedoor class - subclass of a Door)
- right sliding door (Sidedoor class - subclass of a Door)


The minivan object HAS A constructor which you pass the initial string to. The constructor parses this information and sets the state of the minivan.

Then, in the minivan, you can ask it questions:
Code:
if(minivan.canOpenLeftSlidingDoor())
{

}

So you can fetch state from these objects.

It will be a lot of methods and classes, but it should all be fairly logical.
Reply


Messages In This Thread
C++ Programming help needed - by InvictHero - 2014-02-25, 06:43 PM
C++ Programming help needed - by Untradeable - 2014-02-25, 06:47 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 06:50 PM
C++ Programming help needed - by VerrKol - 2014-02-25, 06:52 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 06:59 PM
C++ Programming help needed - by Fiel - 2014-02-25, 07:00 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 07:07 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 07:26 PM
C++ Programming help needed - by SaptaZapta - 2014-02-25, 10:42 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 10:56 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)