dont understand my error here.

So I'm working on a school project and i have a couple classes.
In one of my classes, lets call it "RedLine" im instantiating a different class called "Passangers" using the following lines

Passangers *pass; (this line is in the private section)

pass = new Passangers; (this line is in my default constructor)

it works completly fine. However, i have another class called "BlueLine" and im attempting to do literally the exact same thing since that class also uses methods from Passangers, and im doing the exact same declaration.

Passangers *pass; (in private)

pass = new Passangers; (default construrctor scetion)

Now, the compiler is throwing me an error saying nonsense like undeclared identifier, missing type specifier - int assumed, etc etc

This is extremely wierd cuz why would it work in one class but not the other? Any help would be appreciated.
Last edited on
It might help if you posted your source and the actual error the compiler processes.
Sounds like your BlueLine class is declared before the Passengers class, so the Passengers class knows nothing about it. It's best to declare your classes etc in a header file and then include that at the top of the source code file in which you need to use those classes.
Last edited on
Topic archived. No new replies allowed.