#ifndef _NODE_H_
#define _NODE_H_

#ifndef _SHAPE_H_
  #define _SHAPE_H_
#endif

class Node
{
	private:
		Shape * val;
		Node *next;
	public:
		Node();
		Node(Shape *);
		Shape * getShape();
		void printShape();
		void printDotShape();
		Node *  getNext();
		void setNext(Node *);
};

Node::Node()
{
	next = NULL;
}

Node::Node(Shape * s)
{
	val = s;
}

Shape * Node::getShape()
{
	return val;
}

void Node::printShape()
{
	std::cout<<getShape();
}

Node * Node::getNext()
{
	return next;
}

void Node::printDotShape()
{
	Shape *tmp = getShape();
	/* It is ALWAYS good programming to do a dynamic_cast
	   within an if statement, this prevents memory issues! */
	if (Circle *c = dynamic_cast<Circle*>(tmp))
		std::cout<<*c;
	if (Square *s = dynamic_cast<Square*>(tmp))
		std::cout<<*s;
}

void Node::setNext(Node * n)
{
	next = n;
}

#endif

