can not figure this error out

if (questType == "TF"){ //True/False Questions
QuestionTF QuestionTF();
myTestBank[number] = QuestionTF; /*error__cannot convert'QuestionTF()' to
'QuestionClass' in assignment*/
getline(infile, theQuestion);
myTestBank[number]->setQuestion(theQuestion, valueOfQuestion);
}
Last edited on
Line 2 looks like a function declaration. Remove parentheses.

Why do you have typename identical to variablename?
those are actually a derived class of True or False, from a super class.
I added that line to the code because I was getting another error before telling me to do so.
Post the actual error message(s), and enough (formatted) code to judge what the problem is. The error messages are not often what you think.

Line 2 is definitely a problem, as said above.
Line 3, it appears that based on a similar thought process to line 2, you're mistaking a class for an object, equivalent to:

1
2
int int();
myArray[number] = int;


You need to create an object of your type first, for example:

1
2
3
QuestionTF myQuestion;
...
myTestBank[number] = myQuestion;


Of course, this could all be completely off-topic, things will be clearer with the actual error message and more code.
Topic archived. No new replies allowed.