cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Location of the keyword 'const' and its
Location of the keyword 'const' and its meaning
Oct 13, 2015 at 11:44pm UTC
Deliberation
(32)
Hello,
I am having a trouble recognizing the meaning of the keyword const
depending on its location.
There are three const in the following code.
Can anyone help on clarifying meaning of each const in this case?
Thank you.
1
2
3
const
void
setInt
const
(
const
int
k){ x = k; }
Oct 13, 2015 at 11:49pm UTC
Ericool
(522)
mistake cannot return a const and be void(no return value)
second const ghost after () to means this member method is not modifying any member attribute , the third const means a constant integer value.
Oct 13, 2015 at 11:55pm UTC
YFGHNG
(319)
This might be of help in determining which
const
means what and where
http://duramecho.com/ComputerInformation/WhyHowCppConst.html
Topic archived. No new replies allowed.