我正在尝试实现链接列表,但在编译时会收到错误:
intsllist看起来像已经被声明给我,所以我真的很困惑.
intsllst.cpp
#include <iostream> #include "intsllst.h" int intsllist::deleteFromHead(){ } int main(){ }
intsllst.h
#ifndef INT_LINKED_LIST #define INT_LINKED_LIST #include <cstddef> class IntsllNode{ int info; IntsllNode *next; IntsllNode(int el,IntsllNode *ptr = NULL){ info = el; next = ptr; } }; class Intsllist{ public: Intsllist(){ head = tail = NULL; } ~Intsllist(); int isEmpty(); bool isInList(int) const; void addToHead(int); void addToTail(int); int deleteFromHead(); int deleteFromTail(); void deleteNode(int); private: IntsllNode *head,*tail; }; #endif