MultipleChoiceQuestion Class Reference

#include <MultipleChoiceQuestion.h>

Inheritance diagram for MultipleChoiceQuestion:

Inheritance graph
[legend]
Collaboration diagram for MultipleChoiceQuestion:

Collaboration graph
[legend]

Detailed Description

Question class implementing a multiple choice question.

Definition at line 106 of file MultipleChoiceQuestion.h.


Public Member Functions

void addAnswer (string answer, string value, string explanation)
 Add an answer to the set of allowed answers.
virtual void explain ()
 Explain the question.
size_t countAnswers ()
 Get the number of answers in the answer set.
virtual string ask ()
 Ask the question.
void dropChoice (string choice)
 Remove one answer from the answer set.
virtual void haveChosen (string choice)
 Override this to do something special with the answer received.
string getFirstChoice ()
 Return the first possible answer.

Protected Attributes

AnswerSet mAnswerSet
 Set containing all allowed answers.

Member Function Documentation

void MultipleChoiceQuestion::addAnswer ( string  answer,
string  value,
string  explanation 
) [inline]

Add an answer to the set of allowed answers.

Definition at line 112 of file MultipleChoiceQuestion.h.

References mAnswerSet.

Referenced by add_disks(), and main().

virtual void MultipleChoiceQuestion::explain (  )  [inline, virtual]

Explain the question.

Reimplemented from Question.

Definition at line 120 of file MultipleChoiceQuestion.h.

References Question::explain(), and mAnswerSet.

size_t MultipleChoiceQuestion::countAnswers (  )  [inline]

Get the number of answers in the answer set.

Definition at line 146 of file MultipleChoiceQuestion.h.

References mAnswerSet.

Referenced by add_disks(), and main().

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

Ask the question.

Reimplemented from FreeTextQuestion.

Definition at line 154 of file MultipleChoiceQuestion.h.

References FreeTextQuestion::ask(), haveChosen(), Question::mAnswer, mAnswerSet, and FreeTextQuestion::setOptions().

Referenced by add_disks(), and main().

void MultipleChoiceQuestion::dropChoice ( string  choice  )  [inline]

Remove one answer from the answer set.

Definition at line 214 of file MultipleChoiceQuestion.h.

References Question::mAnswer, and mAnswerSet.

Referenced by ShrinkingChoiceQuestion::haveChosen(), and main().

virtual void MultipleChoiceQuestion::haveChosen ( string  choice  )  [inline, virtual]

Override this to do something special with the answer received.

Reimplemented in ShrinkingChoiceQuestion.

Definition at line 236 of file MultipleChoiceQuestion.h.

Referenced by ask().

string MultipleChoiceQuestion::getFirstChoice (  )  [inline]

Return the first possible answer.

Definition at line 243 of file MultipleChoiceQuestion.h.

References mAnswerSet.

Referenced by main().


Field Documentation

Set containing all allowed answers.

Definition at line 249 of file MultipleChoiceQuestion.h.

Referenced by addAnswer(), ask(), countAnswers(), dropChoice(), explain(), and getFirstChoice().


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

SourceForge.net Logo
Project space on SourceForge.net