Click here to Skip to main content
13,804,051 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
class Process
{
public int Pid;
public string name;
public int ExecutionTime;
public string Status;

public Process(int pd, string nm, int et, string st)
{
this.Pid = pd;
this.name = nm;
this.ExecutionTime = et;
this.Status = st;

}

public void enqueue(Process P ) //public void enqueue (int item)
{
if (rear == max - 1)
{
Console.WriteLine("Queue Overflow");
return;
}
else
{
ele[++rear] = P.Pid; // ele[++rear] = item ;
}

}

 Q.enqueue(typeof(Process) );

What I have tried:

I want to add a process into queue which i have declared it into class Process while enquing that process how do i have to call it in function while executing with my type process mention in the last line of code -- Q.enqueue(typeof(Process) ); --
Posted
Updated 8-Dec-18 10:33am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You don't add a Type to the queue, you add an instance
Process p = new Process(...);
Q.enqueue(p);


You do realise there is a generic Queue<T> class in the .Net collections?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.181218.1 | Last Updated 8 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100