Hello, I am new here(but I have lurked off and on). I finally decided to post about this. I was trying to get used to using linked list type structures and was trying to make one, but I did something major wrong here.
As this is, it compiles fine. However, if I change main toCode:#include <iostream.h> class mylinky { private: static mylinky *first; mylinky *next; char content; public: mylinky(char input='p') { if (first==0) { first=this; content=input; next=0; } else { mylinky *finger; finger=first; while(!(finger->next==0)){finger=finger->next;}; first=this; next=0; }; } void printContents(void) { mylinky *finger; finger=first; while(!(finger==0)) { cout<<finger->content<<"."; finger=finger->next; }; } }; int main (void) { system("PAUSE"); }
I get [Linker error] undefined reference to `mylinky::first' about 5 times. I know I am probably doing something fairly wrong here. I was tempted not to post this at all, but I figured I would give it a shot.Code:int main (void) { mylinky test = mylinky('q'); system("PAUSE"); }