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
Please can someone explain it to me?
Please can someone explain it to me?
May 26, 2014 at 6:54am UTC
Wesp
(13)
why we use const in this case?
1
2
void
function_name()
const
;
May 26, 2014 at 6:59am UTC
keskiverto
(10402)
You don't show enough context. Is this a standalone function or a member of a class?
May 26, 2014 at 6:59am UTC
Lachlan Easton
(699)
(Assuming it's a member of a class) In this context it means you are not allowed to edit any non-mutable members of
this
inside the function, it marks it as safe to call on const objects.
http://msdn.microsoft.com/en-us/library/6ke686zh.aspx
Last edited on
May 26, 2014 at 7:00am UTC
May 26, 2014 at 7:55am UTC
Wesp
(13)
it's a member of a class
May 26, 2014 at 3:12pm UTC
Pter0dactyl
(196)
the keyword const makes the a "read only" function.U cant use it to modify data of object but u can use it to read the data of that object.
Topic archived. No new replies allowed.