#include"frontBackList.hpp" frontBackList::~frontBackList() { } bool frontBackList::insertAtFront(int item) { if(isEmpty()){ front=back=new simpleNode(item); return true; } return simpleList::insertAtFront(item); } bool frontBackList::insertAtBack(int item) { simpleNode *tmp; tmp=new simpleNode(item); if(isEmpty()) { front=back=tmp; return true; } back->setNext(tmp); back=tmp; return true; } bool frontBackList::removeFromFront(int &item){ simpleNode *tmp; if(isEmpty()) return false; tmp=front; if(front==back){ front=back=nullptr; item=tmp->getData(); delete tmp; return true; } else return simpleList::removeFromFront(item); } bool frontBackList::removeFromBack(int &item) { simpleNode *tmp,*current; if(isEmpty()) return false; tmp=back; if (front==back) { front=back=nullptr; } else { current=front; while(current->getNext()!=back) current=current->getNext(); back=current; current->setNext(nullptr); } item=tmp->getData(); delete tmp; return true; }