开发者

Retrieving member item from a queue?

开发者 https://www.devze.com 2023-03-19 11:46 出处:网络
I\'m new to c++ so please bear with me if my terminology and knowledge is off. I\'m trying to print out or retrieve the string jobName after passing the JOB to a queue. In queue.h I have:

I'm new to c++ so please bear with me if my terminology and knowledge is off.

I'm trying to print out or retrieve the string jobName after passing the JOB to a queue. In queue.h I have:

struct开发者_如何转开发 JOB {
  string jobName;
  int runtime;
};

In queue.cpp I am trying to write the appropriate method:

void Queue::display(){
  cout << frontPtr->job.jobName;
}

I'm completely clueless what to do. And yes, this is a small part of a school assignment. Right now, it says error: 'struct Queue::QueueNode' has no member named 'job'. So lost, please help.


The key will be in the definition of struct Queue::QueueNode. Look there, and see what field it has that will give you a struct JOB.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号