Okay so I have a class called Questions and another called Responses. They're in seperate files. I have 3 vector variables of type Questions called beginnerQuestions, intermediateQuestions and advancedQuestions which I'm trying to pass to a method (goToNextQuestion) within Responses but it doesn't know what type Questions is i.e. it's undefined.
Within Questions class:
r.goToNextQuestion(questionBox, a, b, c, d, begCount, beginnerQuestions,
randomAnswers, intermediateQuestions, intCount, advancedQuestions,
advCount); //call goToNextQuestion method in Responses classWithin Responses class:void goToNextQuestion(TMemo *questionBox, TButton *a, TButton *b,
TButton *c, TButton *d, int begCount, vector<Questions> beginnerQuestions,
vector<wchar_t*> randomAnswers, vector<Questions> intermediateQuestions,
int intCount, vector<Questions> advancedQuestions, int advCount)
{
begCount++;
if (begCount <= 4)
{
questionBox->Text = beginnerQuestions[begCount].getQuestion();
randomAnswers = Questions::randomizeAnswers(beginnerQuestions, begCount);
}
else if (begCount <= 9)
{
questionBox->Text = intermediateQuestions[intCount].getQuestion();
randomAnswers = Questions::randomizeAnswers(intermediateQuestions, intCount);
intCount++;
}
else if (begCount <= 14)
{
questionBox->Text = advancedQuestions[advCount].getQuestion();
randomAnswers = Questions::randomizeAnswers(advancedQuestions, advCount);
advCount++;
}
else if (begCount == 15)
{
Application->MessageBox(L"You won $1,000,000!",
L"Congratulations!", MB_OK);
Application->Terminate();
}
a->Caption = randomAnswers[0];
b->Caption = randomAnswers[1];
c->Caption = randomAnswers[2];
d->Caption = randomAnswers[3];
}
How would I allow class Responses to know the type 'Questions'?
Any questions - please ask.
Also, is passing a bunch of variables bad? I mean, not bad, but does it really slow down the performance of the application? To me it seems like stuffing someone's mouth with a bag of marshmellows and trying to eat them all at once.


Sign In
Create Account


Back to top









