text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

Queen Class Reference

#include <Queen.h>

List of all members.


Detailed Description

The Queen class.

Definition at line 22 of file Queen.h.

Public Member Functions

 Queen ()
 Queen (int inRow, int inCol)
int getCol () const
int getRow () const
void nextRow ()
bool isUnderAttack () const

Static Public Member Functions

static void setBoard (const Board *bPtr)

Private Attributes

int row
int col

Static Private Attributes

static const BoardboardPtr


Constructor & Destructor Documentation

Queen::Queen  ) 
 

Puts queen in upper left corner of board.

Queen::Queen int  inRow,
int  inCol
 

Places Queen in supplied location.


Member Function Documentation

int Queen::getCol  )  const
 

Returns:
Column number.

Referenced by Board::placeQueens().

int Queen::getRow  )  const
 

Returns:
Row number.

void Queen::nextRow  ) 
 

Moves queen to next row.

bool Queen::isUnderAttack  )  const
 

Determines whether the queen is under attack by another queen.

Returns:
If there is a queen in the same row or the same diagonal, returns true; otherwise, returns false.

static void Queen::setBoard const Board bPtr  )  [static]
 

Saves a pointer to the board for all queens.


Member Data Documentation

int Queen::row [private]
 

Row (or prospective row) of queen if it is on the board.

Definition at line 47 of file Queen.h.

int Queen::col [private]
 

Column (or prospective column) of queen if it is on the board.

Definition at line 49 of file Queen.h.

const Board* Queen::boardPtr [static, private]
 

All queens share the same board.

Definition at line 52 of file Queen.h.


The documentation for this class was generated from the following file:

Generated on Sun Aug 27 13:27:58 2006 for AWLogo by  doxygen 1.4.6