Creating DataType for linked List c++ -
i trying create linked list info in node custom datatype of type car
holds arrival time , departure time of cars in garage. when run code maintain getting
lnk2019 error: unresolved external symbol "public: __thiscall car::car(void)" (??0car@@qae@xz) referenced in function "public: __thiscall carnode::carnode(void)" (??0carnode@@qae@xz).
here code:
#include <cstdlib> #include <iostream> #include <string> using namespace std; class auto { public: car(); int getarrival() { homecoming arrival; }; int getdeparture() { homecoming departure; }; int arrival = 0; int departure = 0; }; class carnode { public: auto data; carnode* next; }; class carlinkedlist { public: carlinkedlist(car &e) { cout << "constructor car: " << e.getarrival() << endl; head = new carnode; head->data = e; head->next = null; } void addfront(car& e) { carnode *v = new carnode; v->data = e; v->next = head; head = v; cout << "addfront: new head " << head->data.getarrival() << endl; } private: carnode *head; // pointer head of list }; int main() { auto chevy; carlinkedlist *s; s = new carlinkedlist(chevy); s->printsll(); cin.get(); }
you have in code:
class auto { public: car();
but don't see definition of anywhere:
car::car() { ... }
c++ linked-list nodes
No comments:
Post a Comment