Hello there! I am reacquainting myself with C/C++ after a few years of not practicing it. I am practicing Linked Lists but I cannot succeed in compiling a code. Take a look:
Base Class Declaration
This is the code I am trying to create a linked list:Code:class Base { char *pstrName; //STORE NAME char *pstrId; //STORE ID static int iCount; //KEEP TRACK OF THE CLASSES CREATED public: //CONSTRUCTOR(S) AND DESTRUCTORS Base(); Base(char *Name, char *Id); virtual ~Base(); //ACCESSOR METHODS char *ReturnName(); char *ReturnId(); int ReturnCount(); //LINKED LIST class Base *next; };
Although when I attempt to compile the code it gives me an error....I can't figure it out...Code:Base *LinkedBase1 = new Base(); Base *pHead = (Base*)0; pHead->next = LinkedBase1;
Can someone help me? Thanks in Advance...Code:------ Build started: Project: Classes, Configuration: Debug Win32 ------ 1>Compiling... 1>main.cpp 1>c:\documents and settings\obliviouse\my documents\visual studio 2005\projects\classes\classes\main.cpp(15) : error C2143: syntax error : missing ';' before '->' 1>c:\documents and settings\obliviouse\my documents\visual studio 2005\projects\classes\classes\main.cpp(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\documents and settings\obliviouse\my documents\visual studio 2005\projects\classes\classes\main.cpp(15) : error C2040: 'pHead' : 'int' differs in levels of indirection from 'Base *'



LinkBack URL
About LinkBacks


