All pastes #960370 Raw Edit

Stuff

public text v1 · immutable
#960370 ·published 2008-03-28 01:37 UTC
rendered paste body
// Provide abstract class for users of the class to interface with the list with
 class LList {
	public:
		// VIRTUAL FUNCTIONS
		// Find the length of this list
		virtual int length()=0; //=0 makes the class abstract
	
		// Get the list stored in the next position of the list
		 virtual LList* getNext()=0;
	
		// Get the value stored at this position of the list
		int virtual getVal()=0;

		// Deconstruct the List (Virtual allows subclass Deconstructors to be called)
		virtual ~LList();
	
		// STATIC FUNCTIONS
		//Factory method for the empty list
		static LList* make();
	
		//Cleans up after the list is finished: Deletes memory allocated for entire list
		static void clean(LList* list);
	
		// Produce a LList with the given value added to the given list
		static LList* Cons(int value, LList* rest);		
};