Click here to Skip to main content
15,881,033 members
Home / Discussions / C#
   

C#

 
AnswerRe: Document to represent a document node in a print queue Pin
OriginalGriff14-Nov-15 1:21
mveOriginalGriff14-Nov-15 1:21 
QuestionPrint Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 1:06
professionalTridip Bhattacharjee14-Nov-15 1:06 
AnswerRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 1:20
mveOriginalGriff14-Nov-15 1:20 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 5:12
professionalTridip Bhattacharjee14-Nov-15 5:12 
GeneralRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 5:29
mveOriginalGriff14-Nov-15 5:29 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 5:22
professionalTridip Bhattacharjee14-Nov-15 5:22 
GeneralRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 5:35
mveOriginalGriff14-Nov-15 5:35 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 8:27
professionalTridip Bhattacharjee14-Nov-15 8:27 
this is my full updated code but still the code is not completed and there is error.

see the code and also read my first post and guide me how to complete the program.
C#
class PrintQueue
    {
        private Document head;

        private int size;
        public int Count
        {
            get
            {
                return size;
            }
        }

        public void Push(Object data)
        {
            Document toAdd = new Document();
            toAdd.data = data;

            Document current = head;
            while (current.Next != null)
            {
                current = current.Next;
            }
            current.Next = toAdd;
            size++;
        }

        public bool Pop()
        {
            Document tempNode = head;

            Document lastNode = null;
            int count = 0;

            if (size > 0)
            {
                while (tempNode != null)
                {
                    if (count == size - 1)
                    {
                        lastNode.Next = tempNode.Next;
                        return true;
                    }
                    count++;

                    lastNode = tempNode;
                    tempNode = tempNode.Next;
                }
            }
            return false;
        }
    }


    public abstract class Document
    {
        public Document Next;
        public Object data;

        public string Subject { get; set; }

        public abstract string type();
    }

    public class WordDocument : Document
    {
        public override string type()
        {
            return "docx";
        }
    }

    public class PdfDocument : Document
    {
        public override string type()
        {
            return "pdf";
        }
    }


for this line i will get error
C#
Document toAdd = new Document();


but how could i use there worddoc or pdfdoc class because i do not know which one should use inside in PrintQueue class?

so tell me what is the work around and also see and tell me Pop() function is properly constructed or not ?

thanks
tbhattacharjee

GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee14-Nov-15 18:33
professionalTridip Bhattacharjee14-Nov-15 18:33 
GeneralRe: Print Queue implementation by linked list class Pin
OriginalGriff14-Nov-15 23:23
mveOriginalGriff14-Nov-15 23:23 
GeneralRe: Print Queue implementation by linked list class Pin
Tridip Bhattacharjee15-Nov-15 21:14
professionalTridip Bhattacharjee15-Nov-15 21:14 
GeneralRe: Print Queue implementation by linked list class PinPopular
OriginalGriff15-Nov-15 21:25
mveOriginalGriff15-Nov-15 21:25 
QuestionParallel vs Threading Pin
Ger Hayden14-Nov-15 0:22
Ger Hayden14-Nov-15 0:22 
AnswerRe: Parallel vs Threading Pin
Gerry Schmitz14-Nov-15 9:42
mveGerry Schmitz14-Nov-15 9:42 
GeneralRe: Parallel vs Threading Pin
Ger Hayden14-Nov-15 11:27
Ger Hayden14-Nov-15 11:27 
GeneralRe: Parallel vs Threading Pin
Gerry Schmitz14-Nov-15 20:29
mveGerry Schmitz14-Nov-15 20:29 
GeneralRe: Parallel vs Threading Pin
Ger Hayden15-Nov-15 9:50
Ger Hayden15-Nov-15 9:50 
GeneralRe: Parallel vs Threading Pin
Gerry Schmitz15-Nov-15 10:22
mveGerry Schmitz15-Nov-15 10:22 
GeneralRe: Parallel vs Threading Pin
Ger Hayden18-Nov-15 3:24
Ger Hayden18-Nov-15 3:24 
QuestionMoving Data from one form to another Pin
KakitaIppatsu13-Nov-15 14:45
KakitaIppatsu13-Nov-15 14:45 
AnswerRe: Moving Data from one form to another Pin
John Torjo13-Nov-15 14:51
professionalJohn Torjo13-Nov-15 14:51 
GeneralRe: Moving Data from one form to another Pin
KakitaIppatsu13-Nov-15 15:24
KakitaIppatsu13-Nov-15 15:24 
GeneralRe: Moving Data from one form to another Pin
John Torjo13-Nov-15 15:30
professionalJohn Torjo13-Nov-15 15:30 
GeneralRe: Moving Data from one form to another Pin
OriginalGriff13-Nov-15 21:43
mveOriginalGriff13-Nov-15 21:43 
GeneralRe: Moving Data from one form to another Pin
OriginalGriff13-Nov-15 21:35
mveOriginalGriff13-Nov-15 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.