CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2011
    Location
    Tennessee
    Posts
    46

    Question Statement concerning queue's?

    Isn't this statement invalid:

    queueADT<int> newQueue;

    shouldn't it be:

    queueType<int> newQueue;

    *note: ADT stands for Abstract Data Type

    I don't think that putting ADT would be proper and also wrong where Type should be instead?
    Does anyone know what I am talking about, or correct me? Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Statement concerning queue's?

    Eh, it depends on the type name. Both queueADT and queueType are valid identifiers, so either can be used to name the queue container type. If you really wanted to, you could name it Wh1t3gh0st and write:
    Code:
    Wh1t3gh0st<int> newQueue;
    except that it would be a pretty bad type name here.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #3
    Join Date
    Oct 2011
    Location
    Tennessee
    Posts
    46

    Re: Statement concerning queue's?

    ok thanks similar question what if i were to put any number within a parenthesis and taken into account that the number can be a double or int whatever. is this valid:

    queueADT<double> newQueue(-24)

    or like you said following the same pattern

    "whatevername"<data type> "functionname"(integer, number, etc.)

    correct?

  4. #4
    Join Date
    Oct 2011
    Location
    Tennessee
    Posts
    46

    Question Re: Statement concerning queue's?

    like if I were to do something like:

    queueType<double> queue(-20);

    then

    queue.addQueue(10);

    would this mean that there is initially a value of -20 in the queue? then 10 -20 would be in the queue roughly saying?

    Just want to know what the it is actually doing if there is a value in that first line of code:

    queueType<double> queue(-20);

    thanks

  5. #5
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Statement concerning queue's?

    You need to refer to the relevant documentation.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  6. #6
    Join Date
    Jan 2009
    Posts
    596

    Re: Statement concerning queue's?

    Quote Originally Posted by Wh1t3gh0st View Post
    like if I were to do something like:

    queueType<double> queue(-20);

    then

    queue.addQueue(10);

    would this mean that there is initially a value of -20 in the queue? then 10 -20 would be in the queue roughly saying?

    Just want to know what the it is actually doing if there is a value in that first line of code:

    queueType<double> queue(-20);

    thanks
    As laserlight said, you'll need to look up the documentation for queueType/queueADT. If they have a constructor which takes a parameter then queue(-20) may be valid. If they don't, it isn't. The documentation will tell you what constructors there are.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured