123456789101112131415161718192021
class node { public: node(); node(int, node*); int get_element(); node get_next(); private: int data; node* next; }; node::node(int x, node* y) { data = x; next = y; } int node::get_element() { return data; } node node::get_next() { return next; // Gives error: no suitable constructor exists to convert from "node*" to "node" }
1234567891011
class node { //... node *get_next(); //... }; //... node *node::get_next() { return next; }