NumberQuestion Class Reference

#include <NumberQuestion.h>

Inheritance diagram for NumberQuestion:

Inheritance graph
[legend]
Collaboration diagram for NumberQuestion:

Collaboration graph
[legend]

Detailed Description

Question class that accepts a numeric answer within a defined range.

Definition at line 65 of file NumberQuestion.h.


Public Member Functions

void setRange (int low, int high)
 Define the allowable range for the answer.
int getNum ()
 Convert the answer to a number.
virtual string ask ()
 Ask the question and return the answer.

Protected Attributes

int mLow
 Low limit of the allowed range.
int mHigh
 High limit of the allowed range.

Member Function Documentation

void NumberQuestion::setRange ( int  low,
int  high 
) [inline]

Define the allowable range for the answer.

Definition at line 71 of file NumberQuestion.h.

References mHigh, and mLow.

Referenced by add_disks(), and main().

int NumberQuestion::getNum (  )  [inline]

Convert the answer to a number.

Definition at line 79 of file NumberQuestion.h.

References Question::mAnswer, and s2i().

Referenced by main().

virtual string NumberQuestion::ask (  )  [inline, virtual]

Ask the question and return the answer.

Reimplemented from FreeTextQuestion.

Definition at line 87 of file NumberQuestion.h.

References FreeTextQuestion::ask(), CLogicException, i2s(), Question::mAnswer, mHigh, mLow, s2i(), and FreeTextQuestion::setOptions().

Referenced by add_disks(), and main().


Field Documentation

int NumberQuestion::mLow [protected]

Low limit of the allowed range.

Definition at line 133 of file NumberQuestion.h.

Referenced by ask(), and setRange().

int NumberQuestion::mHigh [protected]

High limit of the allowed range.

Definition at line 135 of file NumberQuestion.h.

Referenced by ask(), and setRange().


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

SourceForge.net Logo
Project space on SourceForge.net