Question: Study the following code snippet: class Question { public: Question ( ) ; void set _ text ( string new _ text ) ; void

Study the following code snippet:
class Question
{
public:
Question();
void set_text(string new_text);
void set_answer(string new_answer);
void display() const;
private:
string text;
string answer;
};
Question::Question()
{
text ="";
answer ="";
}
void Question::set_text(string new_text)
{
text = new_text;
}
void Question::set_answer(string new_answer)
{
answer = new_answer;
}
void Question::display() const
{
cout << "Question: "<< text << endl;
cout << "Answer: "<< answer << endl;
}
class ChoiceQuestion : public Question
{
public:
ChoiceQuestion();
void set_text(string new_text);
void set_answer(string new_answer);
void display() const;
};
ChoiceQuestion::ChoiceQuestion()
: Question()
{}
void ChoiceQuestion::set_text(string new_text)
{
Question::set_text(new_text);
}
void ChoiceQuestion::set_answer(string new_answer)
{
Question::set_answer(new_answer);
}
int main()
{
ChoiceQuestion q1;
q1.set_text("What is C++?");
return 0;
}
Which function is called by the q1.set_text("What is C++") statement?
void ChoiceQuestion::set_text(string new_text)
void Question::set_text(string new_text)
ChoiceQuestion::ChoiceQuestion()
Question::Question()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!