What the hell is going on here??
Is it language bug or my brain exploded already?
I tried to compile this on many compiler but they gave me the same error code.
Code:class Node { protected: Node *next; Node *previous; // error: `Node*Node::previous' is protected public: virtual Node *getNext(void) const { return next; } virtual void setNext(Node *next) { this->next = next; } virtual Node *getPrevious(void) const { return previous; } virtual void setPrevious(Node *previous) { this->previous = previous; } }; class LinkedNode : public Node // See? LinkedNode inherits the Node!! // It supposed be able to access protected members of Node!! { public: virtual void setNext(Node *next) { // within this context if(next) { next->previous = this; } Node::setNext(next); } virtual void setPrevious(Node *previous) { if(previous) { previous->next = this; } Node::setPrevious(previous); } };