View Single Post
Old 06-09-2004, 01:47 PM   #1 (permalink)
saiz66
Registered User
 
Join Date: May 2004
Posts: 11
saiz66 is on a distinguished road
c++ class question

Hi. I basically have to create a Hospital program. I created a Patient class which holds each of the patient's priority, treatment time and so on. Well I made those variables private and created a getPriority, setPriority methods in public. Those look like this:

void setPriority(int priority);
int getPriority();

That seems to be fine. Then I have to insert into a priority queue, which has already been created by my professor. I have then created a Priority Queue:

PQueue <Patient> PQ;

Ok. then I inserted the patient class into the priority queue:

PQ.Insert(patient[i]);

And this is where I get confused. I want to get the patients with the highest priority and print them out. The function to get the highest priority is:

int DeleteMin ( Etype & E );

I understand that it returns the highest priority in Etype & E where the Etype is class Patient. I tried this:

PQ.DeleteMin(patient[i]);

I am confused. Do I need to create a new class. Anybody can help me out? Thanks in advance!
saiz66 is offline   Reply With Quote