Base class problems - polymorphism

How can i get the top three prototypes to be polymorphic? And do i have to make them abstract?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

class ExamQuestion
{


    public:
        /**
         * Present, i.e. display a question to the user and get user's response.
         */
        void presentQuestion();

        /** Grade the question and return the points earned.
         * \return The points earned.
         */
        virtual int  getPoints() = 0;

        /**
         * Print results of the graded question
         */
        virtual void printGraded();

        /** Initializing constructor */
        ExamQuestion(int iQuestionNumber, string sQuestion, int iPointsWorth);

        /** Access m_PointsWorth
         * \return The current value of m_PointsWorth
         */
        int getPointsWorth()                { return m_PointsWorth; }

        /** Set m_PointsWorth
         * \param val New value to set
         */
        void setPointsWorth(int val)        { m_PointsWorth = val; }

        /** Access m_Question
         * \return The current value of m_Question
         */
        string getQuestion()                { return m_Question; }

        /** Set m_Question
         * \param val New value to set
         */
        void setQuestion(string val)        { m_Question = val; }

        /** Access m_QuestionNumber
         *  \return The current value of m_QuestionNumber
         */
        int getQuestionNumber()             { return m_QuestionNumber; }

        /** Set m_QuestionNumber
         * \param val New value to set
         */
        void setQuestionNumber(int val)     { m_QuestionNumber = val; }

    protected:
        int m_PointsWorth;     //!< Member variable "m_PointsWorth"
        int m_QuestionNumber;  //!< Member variable "m_QuestionNumber"
        string m_Question;     //!< Member variable "m_Question"
};

#endif // EXAMQUESTION_H 
It is not clear what you want.
Topic archived. No new replies allowed.