-
April 4th, 2012, 08:22 PM
#1
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.
-
April 4th, 2012, 08:55 PM
#2
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.
-
April 4th, 2012, 09:03 PM
#3
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?
-
April 4th, 2012, 09:14 PM
#4
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
-
April 4th, 2012, 10:40 PM
#5
Re: Statement concerning queue's?
You need to refer to the relevant documentation.
-
April 5th, 2012, 04:24 AM
#6
Re: Statement concerning queue's?
Originally Posted by Wh1t3gh0st
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|