0

I have an issue adding nodes to a linked list dynamically. I have a header and source file for mode class and 1 for list class.

Class Enemy( private: ... Enemy* nextE(next); public: Enemy(int eHP, string eName, int eExp, int eDamage) ... addEnemy(int eHP, string eName, int eExp, int eDamage) Linked List Header File Enemy newEnemy = new Enemy(eHP, eName, eExp, eDamage) if(tailE = NULL) headE = tailE = newEnemy <- Problem Code compiles no problem without this function. The compiler gives an error where it says "a value of type "Enemy*" cannot be assigned to an entity of type "Enemy" I don't have enough space to write more detail

13th Dec 2016, 10:46 PM
Eddy
2 odpowiedzi
+ 4
You forgot to specify that newEnemy is a pointer: Enemy* newEnemy = new Enemy(eHP, eName,eExp,eDamage)
13th Dec 2016, 11:45 PM
Karl T.
Karl T. - avatar
0
I did that but it's still giving me the same error.
14th Dec 2016, 8:00 AM
Eddy