Lecture 13 Flashcards

1
Q

What would it mean for an object to be const?

A

If declared const, an object should not be modifiable.

Problem: how can we use its methods while being sure not to modify it?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens when a function is declared as const?

A
Appending the const keyword to a function signifies that the method is not allowed to alter the class in any manner.
Inside that method, all fields of the class will be treated as if they were declared const.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly