#ifndef __lab1d__ListP__
#define __lab1d__ListP__
#include <iostream>
#include "ListException.h"
#include "ListOutOfRangeException.h"
typedefchar *ItemName;
typedefdouble ItemWeight;
typedefint qty_of_item;
class List {
public:
// Constuctors and destuctor
//** Default Constuctor */
List();
/** Copy Constuctor
* @parm aList The list to copy. */
List(const List& aList);
/** Destuctor */
~List();
// List Opertions
bool isEmpty() const;
int getLenght() const;
void insert(int index,
const ItemName& newItem,
ItemWeight& newItemWeight,
qty_of_item& newQtyOfItem );
// throw(ListOutOfRangException, ListEception);
void remove (int index);
// throw(ListOutOfRangeException);
private:
struct ListNode
{
ItemName item;
ItemWeight Double;
qty_of_item Qty;
ListNode *next;
};
int size;
ListNode *head;
/** Locates a specified node in a liked list
* @pre index is the number of the desired node
* @post None.
* @param index The index of the node to locate
* @return A pointer to the index-th node. if index < 1
* or index > the number of nodes in the list,
* retuns NULL. */
ListNode *find(int index) const;
}; // end of list
// end of header file
#endif /* defined(__lab1d__ListP__) */
I have not code the implementation file of ListP.h
yet. Not sure if that matters.
Some context: this is for homework (by no means is this the solution to my problem[I still have 2-3 other classes to write]), But I am following an linked pointer list ADT example out of "Data Abstraction and Problem Solving with C++: Walls and Mirrors (5th Edition) page 194"
If you're attempting to use a throw specifier, those were deprecated in C++11 and were a bad idea in C++03. However, if you must use them, get rid of the semi-colon immediately following the function declaration and before "throw".