Hello. Currently I am working on a class that holds a vector of pointers to objects.
Compiler errors in Visual Studio C++:
Here is the source for the headers involved:Code:* cppsample\headers\Item.h(31): error C2065: 'ItemClass' : undeclared identifier * cppsample\headers\Item.h(31): error C2955: 'std::vector' : use of class template requires template argument list
Item.h
ItemClass.hCode:#pragma once #include <string> #include <vector> #include "ItemClass.h" using namespace std; typedef short unsigned int sui; //Shorthand form of numbers from 0 to 65,535. typedef short int si; //Shorthand form of numbers from -32,768 to 32,767. class Item { public: Item(); ~Item(); //bool AddClass(ItemClass* cClass); //bool RemoveClass(ItemClass* cClass,bool bDependantsToo); string getName(); sui getMinAtt(); sui getMaxAtt(); sui getAtt(); //Random between min and max sui getDef(); sui getAmt(); bool setAmt(sui newAmt); sui getMaxAmt(); sui getHealth(); bool setHealth(sui newHealth); private: string sName; sui iAmount; vector<ItemClass> cClasses; };
Code:#pragma once #include <string> #include "Item.h" using namespace std; //Classes class ItemClass { public: friend class Item; ItemClass(int minAttack=0,int maxAttack=0,int defense=0,string p="",string s="",ItemClass **apcAllowed=NULL,ItemClass **apcRequired=NULL,ItemClass **apcRestricted=NULL); ~ItemClass(); private: int minAtt; int maxAtt; int def; string prefix; string suffix; ItemClass** RequiredClasses; //AND - All given classes must be present in given item for this class to be added ItemClass** AllowedClasses; //OR - At least one given class must be present in given item for this class to be added ItemClass** RestrictedClasses; //!OR - If any of these classes are present in the given item, this class cannot be added. };



LinkBack URL
About LinkBacks


