here's the class:
Code:
class taxi{
private:
int count;
struct standard{
int age;
char model;
};
public:
double getAvgAge(void){
int total_age=0;
for(int i=0;i<count;i++){
total_age+=standard_obj[i].age;
}
return (double(total_age)/count);
}
taxi (void){
count=3;
standard *standard_obj=new standard[count];
for(int i=0;i<count;i++){
standard_obj[i].age=0;
standard_obj[i].model='x';
}
}
~taxi (void){
delete[] standard_obj;
}
};
- 'standard_obj':undeclared identifier.
- left of '.age' must have a class/struct/union.
- identifier "standard_obj" is undefined.
- cannot delete objects that are not pointers.
im guessing theres a problem with the initializing of the structure-type variable using a pointer. i cant spot any mistakes, but im sure something must be wrong somewhere.
any help is appreciated!