Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:14:16+00:00 2026-05-26T03:14:16+00:00

I am attempting make a simulator class that will use a Queue to add

  • 0

I am attempting make a simulator class that will use a Queue to add the Carriages from Train in to a Queue, so it will become a Queue of carriages. Carriage is also the dataType of the train class.

I will use a method to enqueue trains as they arrive, adding them to different queues. I will also have a method to dequeue trains once their cargo has been unloaded.

I have a Train class which has a private variable of:

LinkedList<Carriage> *list;

Queue class has a private variable of:

LinkedList<dataType> *list;

In my demo file I am calling:

Train* train1; //declare a train.

train1 = new Train(arr); //instantiate train with an array of integers

Queue<Carriage> queue1;  //declare a queue.

queue1 = new Queue<Carriage>(train1); //instantiate queue with train data.

I am having a problem with my queue class, I am not quite sure on how to implement it.

My Queue class.h:

template <typename dataType> //dataType
class Queue
{

public:
           Queue();

       Queue(dataType arr[]);

           ~Queue();

           void pop();

           void push(dataType data);

private:

    LinkedList<dataType> *list;

};

#include "Queue.template"
//there is also a namespace and a macroguard, left them out of this.

EDIT – Did not add enough information.

In the above demo file code, I want to be able to call queue1 = new Queue(train1);

When I do this I get errors so I know I’m doing something wrong with my constructor, as they are both linkedlists, do i need to use a loop to assign the carriages in to the queue?

What I need help with is getting the train carriages in to the queue.

Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:14:17+00:00Added an answer on May 26, 2026 at 3:14 am

    You are passing argument of type LinkedList to a constructor takes argument of array of datatype, which causes the error.

    You can, however, loop through every train1 element, and push it to the Queue.

    As a note, push and pop are function names for the stack. Queue has enqueue and dequeue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to make a NSObject called 'Person' that will hold the login details for
Im attempting to make a little app that lets you add text boxes to
I am attempting to make a program that will pull data such as OS,
I am attempting to make a class that has a template object member inside
I am attempting to make a simple class that serializes itself to disk when
I'm attempting to make a messaging system in which any class derived from Messageable
So I am attempting to make a module that, when imported, will cause any
I'm attempting to make a dynamic drop down that will be filled by a
So I am attempting to make a really simple lightbox that I can use
I am attempting to make a gallery that calls the image names from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.