class Pilot //Class Pilot
{
public:
struct ExperAircraft{
char xaAircraftType[20]; //AircraftType of the pilot's experience
double xaFlightTime; //FlightTime of each AircraftType
};
Pilot()
{
try {piExper=new ExperAircraft[piIncr];}
catch (bad_alloc){throw PilotXptn("NoMemory",PilotXptn::NoMemory);}
}
private:
unsignedint piIdNum; //Pilot Id
char piSurname[20]; //PilotSurname
char piFirstName[16]; //PilotFirstname
ExperAircraft* piExper; //Dynamic array of Pilot's Experience
unsignedint piNoOfExper; //How many values has the piExper array
enum {piIncr=8}; //When piExper needs more memory asks for 8 !
};
class PilotXptn
{
public:
enum {NoMemory};
PilotXptn(std::string FN,int eC=0,int eV=0)
{FunctionName=FN; errorCode=eC; errorValue=eV;}
std::string getFunctionName() const {return FunctionName;}
int getErrorCode() const {return errorCode;}
int getErrorValue() const {return errorValue;}
private:
std::string FunctionName;
int errorCode;
int errorValue;
};
Well i need a class named : Pilot .and at the Constructor i must use the PilotXptn class to control the exceptions( NoMemory when piExper asks for)
My Problem is that i think i did the 2 classes correct but the compiler disagree .giving me the following messages:
1)Type Name expected line 12
2)Catch Statement missing ) line 12
3)Compound statement missing } line 13
@Grey Wolf :
This is not the problem coz i think when we r writing functions classes etc the ProgramCounter jumps to the exact memory where each function,class starts ! so we need to keep the priority only inside the functions ( Pilot , PilotXptn ,main() ) .i hope u understand me what i want to say ( my english sux a bit hehe ).although i tried it...same happens !
@writetonsharma:
i think the new file is a header file so *.h is not the problem in my compiler ... although i tried #include <new> and same happens !
i repeat the compiler's messages :
1)Type Name expected line 12
2)Catch Statement missing ) line 12
3)Compound statement missing } line 13
well any other idea will be welcome...
if i wont solve it in 2 days i ll visit my professor so i ll post the solution in my problem here ! :P