c++ - Error C2079: how can I handle this? -
c++ - Error C2079: how can I handle this? -
when seek including player.h
in battlefield.h
error occurs: error c2079: 'battlefield::firstplayer' uses undefined class 'player'.
can't understand why happening, i've searched through net, , saw circular pattern problem, that's not clear me. help appreciated.
player.h:
#include <iostream> #include <fstream> #ifndef player_h #define player_h #include "classdeck.h" class player { private: char* name; double health; double energy; public: deck playerdeck; player(); player( char* name, double health, double energy ); player( const player& play ); player& operator= ( const player & play ); ~player(); void set_name( char* name ); void set_health( double val ); void set_energy( double val ); void print_player()const; char* get_name()const { homecoming name; } double get_health()const { homecoming health; } double get_energy()const { homecoming energy; } }; #endif
battlefield.h:
#include <iostream> #include <fstream> #ifndef battlefield_h #define battlefield_h #include "classdeck.h" #include "player.h" class battlefield { private: deck firstplayer; //teste na purvi igrach deck secondplayer; //teste na vtori igrach deck semetary; //masiv grobishte player firstplayer1; player secondplayer2; public: deck playedcards; //masiv ot izigrani karti battlefield(); // podrazbirasht se konstruktor ~battlefield(); //destruktor battlefield( const battlefield& battle ); // kopirasht konstruktor battlefield& operator= ( const battlefield& battle ); //operator = void insertleftplaydeck(const deck& deck); // zadavame teste na ediniq igrach void insertrightplaydeck(const deck& deck); //zadavame teste na drugiq igrach void battle(); //funkciq, v koqto dve karti se biqt void display(); //printirashta funkciq void serializer(); //serializirashta const deck get_semetary() const; const deck get_playedcards()const; const deck get_firstplayer() const; const deck get_secondplayer() const; }; #endif
c++ compiler-errors
Comments
Post a Comment