But wait remember what a linkedlist was remember

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: structor for each instance. But wait. Remember what a LinkedList was? Remember LinkedList struct Cust; // forward reference typedef Cust* CustPtr; CustPtr struct Cust { char name[30]; int partysize; Cust *next; }; class LinkedList class LinkedList { public: void Initialise(); void Add(char,int); void Add(char,int void Remove(char,int&); void Remove(char,int private: CustPtr Head; }; Not suitable for a supermarket queue. Applied Programming Applied Programming W e want to be able to create such abstract data We types as linked lists but be able to put any data we desire into these linked lists. we Let's look at another example to illustrate how we Let's can define our own abstract datatypes. datatypes We do that with arrays (built into C++). Let's create a time type. Why can't we do it with our own? We can. What will we call it? How about TimeType. How TimeType We construct generalised classes called templates We'll see these soon. What will it store? time of day in hours, minutes & seconds Applied Programming W hat operations do we want to be able to do with Wh...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online