Computers |
|
| | #1 (permalink) |
| True Techie Join Date: Dec 2004
Posts: 131
| hey. im currently making a program in C++ and have a bit of trouble with the class'. in a header file, i am declareing 2 classes, playerData, and item. in the playerData class, there is a function that requires an 'item' object. when i try to compile, it says that 'item was not declared in this scope'. i am curious as to the code to insert to let the compiler know that there is an 'item' class comming later, similar to letting the compiler know that there is a function comming. cheers for any help. |
| | |
| | #2 (permalink) |
| True Techie Join Date: Oct 2005
Posts: 199
| You need to include the class item. This is done by #include "item.h" in playerData.h item.h Code: class item {
public:
void method1();
}; Code: #include "item.h"
class playerData {
public:
void method2(item i);
}; |
| | |