For that case, the const goes after the () and the function has to be a class member function. In the above, the const is before the () !
@Ivanka - is this a misprint as that is invalid syntax?
It is a promise that the function will not modify the object that it's called on.
obj.readData(); // will not modify obj
It's similar to marking reference parameters as const.
foo(obj); // will not modify obj
Last edited on