constint NUM_QUESTIONS = 9;
Question questions[NUM_QUESTIONS];
int n = NUM_QUESTIONS;
while( --n )
{
questions[n].ask();
}
// Or as a for loop...
for( int i=0l i < NUM_QUESTIONS; ++i )
{
questions[n].ask();
}
You have to declare the class before you can refer to it, so if you put the class in the same file as the example code above then it needs to go above line 2 which is where you refer to it.
if you put the class in a separate file then you need to include that file..
#include "my-file-that-contains-question"
Note that the include uses "" not <> because it is a file in your project not a system file.
Yes. But what file have you put that code in? Is it in the same source file as the one that's failing to compile? Is it in a separate header file? Somewhere else?
I was getting a feeling some time ago that the simplest way to get to the heart of this would be to post the complete source code which is giving rise to the errors, rather than just individual snippets.
I will be torn to pieces for this, but guess what? A very thorough search has revealed the problem to be a typo.
I'd like to thank you all for your help and apologize for having wasted your time. I should have found that error before posting.