hey all,
i'd like to use objects of one class in other classes but i am still having trouble. this is what i have so far:
i get this error:Code://-------------------------------------------------lineup.h-------------------- #ifndef lineup_h #define lineup_h #include "player.h"//Player is the other class class Lineup { public: Lineup(); void mf_Lineup_loadArray(Player *p_h1, Player *p_h2); private: Player home_lineup[2];//this is an array of pointers //to objects of class Player }; #endif //-------------------------------------lineup.cpp-------------------------------- //Lineup.cpp #include "lineup.h" #include "player.h" class Player; Lineup::Lineup() //what's wrong with my constructor? {} void Lineup::mf_Lineup_loadArray(Player *p_h1, Player *p_h2)//this comes from main { home_lineup[0]=&p_h1; home_lineup[1]=&p_h2; }
C:\mprog\sandlot\Lineup.cpp(9) : error C2512: 'Player' : no appropriate default constructor available
C:\mprog\sandlot\Lineup.cpp(13) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class Player ** ' (or there is no acceptable conversion)
C:\mprog\sandlot\Lineup.cpp(14) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class Player ** ' (or there is no acceptable conversion)
thanks in advance