August 2000 QUESTION 2 Total Marks: 15 Marks |
Click here to access other
questions
Click to access |
Consider the following definition of
a polymorphic queue, and the class PrintJobs: (b) Construct an object MyQueue, which is an instantiation of the Queue class with template type PrintJobs. [2 marks] (c) Implement the function Add, such that it takes an object of template type T and adds it to the back of the queue. [4 marks] (d) Implement the function SplitQueue, such that it takes in a reference to a queue and separates it into two queues a and b, such that any PrintJob with the name "priority" is put into queue a, and the others into queue b. [5 marks] (e) Give the name for the form of parameter passing used in the above SplitQueue function, and explain what effect this type of parameter passing has. [2 marks] |