F
fl
Hi,
I am new to C++. The following are from the example of book C primer.
I don't know the difference of them even after I look through the
book. Especially the second "const" of the last line is curious to me.
Thank you in advance.
// return element from head of Queue
// unchecked operation: front on an empty Queue is undefined
Type& front() { return head->item; }
const Type &front() const { return head->item; }
I am new to C++. The following are from the example of book C primer.
I don't know the difference of them even after I look through the
book. Especially the second "const" of the last line is curious to me.
Thank you in advance.
// return element from head of Queue
// unchecked operation: front on an empty Queue is undefined
Type& front() { return head->item; }
const Type &front() const { return head->item; }