Please can someone explain it to me?

why we use const in this case?

  void function_name()const;
You don't show enough context. Is this a standalone function or a member of a class?
(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.
Last edited on
it's a member of a class
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.