Hi,
I have a god structure as such:
And a Link structure which I am using pointers to created a linked list. The Link structure is:Code:struct God { God(string n, string m, string v = "", string w = "") :name(n), mythology(m), vehicle(v), weapon(w) {} private: string name; string mythology; string vehicle; string weapon; };
When I try to create a Link object as such:Code:class Link { public: God god1; Link(God& g, Link* p = 0, Link* s = 0) : god1(g), prev(p), succ(s) {} Link* insert(Link* n); Link* add(Link*n); Link* erase(Link* p); Link* find(const string& s); const Link* find(const string& s) const; Link* advance(int n) const; Link* next() const {return succ;} Link* previous() const {return prev;} private: Link* prev; Link* succ; };
I get an error saying: error C2664: 'Link::Link(God &,Link *,Link *)' : cannot convert parameter 1 from 'const char *' to 'God &'Code:Link* norse_gods = new Link(("Odin", "Norse", "Eight legged horse"), 0, 0);
As far as I can see I havent't defined any consts that would cause this?
Any advice please.
Thanks,
Darren.



LinkBack URL
About LinkBacks



