a question of const

What is the difference of the const between Error_code top(Stack_entry &item)const; and Error_code push(const Stack_entry &item); why the first is at the rear and the second is at the front of the item?
Last edited on
Its the declaration of a constructor for class Queue.
http://www.cplusplus.com/doc/tutorial/classes/
thanks for your response!! can I ask that what the different between the first queue and the second one? why can't I declare class queue just use class queue??thanks
what the different between the first queue and the second one?

The first one specifies that this belongs to the class Queue.
The second declares the constructor.

why can't I declare class queue just use class queue?

You can. You only need to declare (and define) a constructor if you want something in particular to happen when the Queue object is created.

The tutorial page is a starting point, but you will probably need additional study material, such as book(s) in order to get a clearer understanding of the topic.
okay, thanks very much!!
Topic archived. No new replies allowed.