txhookem, on 11 July 2011 - 11:20 AM, said:
He hasn't gone over enums,
Then don't use them. A const int is fine. The same for the static keyword, in this context a const int is fine. An enum is kind of just a named int in C++. It provides a clarity of intent, but key values with good names are really all you're after.
txhookem, on 11 July 2011 - 11:20 AM, said:
and he spent maybe 5-10 minutes max going over boolean operators.
All programming is boolean operators. Conditional branches, bits being flipped. Boolean should be a very big part of the very beginning of a class.
txhookem, on 11 July 2011 - 11:20 AM, said:
Did you actually create the attributes for the seat array in the first line?
The Seat type I gave only has one attribute, name of string type. Mostly because there's nothing else I really need. When you declare a string, it initialize to empty. When you declare a class or struct, it's constructor is called. All the seats in an array of type Seat will start out empty. The constructor initialized it.
There is nothing magic here. You have a collection of seats. They can be initialized with the values you choose. They will start with the default value for their type. The only trait you have to store is the name assigned to the seat. If no name is stored, if the string is empty, then the seat is empty. All other traits you should be able to derive from the position of the seat. You should know where first class begins and ends, so you offer a method to allow the user of the class to check than information.

New Topic/Question
Reply




MultiQuote

|