Reputation: 21
So i have this homework to do and i'm trying to process an array of integers... and ive been given some code written by my instruction and i am very confused on how i can process an array without the name being passed... here ill show you what i mean.
Ive been given this class and i need to write some of the member functions.
class TurtleGraphics
{
private:
const static size_t NROWS = 22; // number of rows in floor
const static size_t NCOLS = 70; // number of colums in floor
const static int STARTING_ROW = 0; // row that turtle will start in
const static int STARTING_COL = 0; // column that turtle will start in
const static int STARTING_DIRECTION = 6; // direction that turtle
// will be facing at the start
// 6 as in 6 o'clock on an analog clock
// The other 3 possible values are 3,9 and 12 o'clock
const static bool STARTING_PEN_POSITION = false; // Pen will be up when
// program starts
// false means pen up, true means pen down
void displayFloor() const; // will display floor on the screen
std::array <std::array <bool, NCOLS>, NROWS> m_Floor;
public:
const static int ARRAY_SIZE = 250;
TurtleGraphics(void); //ctor will init. floor to all "false" values,
// as well as initialization of other data members
void processTurtleMoves( const std::array< int, ARRAY_SIZE> ); // will process
// the commands contained in array "commands"
};
Im trying to write the void processTurtleMoves(const std::array< int, ARRAY_SIZE> );
can anyone tell me why the array has no name, or why it doesn't need a name, or if this is just a mistake ?
The main issue is that im trying to process this array without a name and i'm very confused.
PS. don't have time to get in contact with instructor.
Upvotes: 0
Views: 146
Reputation: 477000
In the function definition, you give the function parameter a name:
void TurtleGraphics::processTurtleMoves(const std::array<int, ARRAY_SIZE> commands)
// ^^^^^^^^
{
// ...
}
Upvotes: 4