Can someone give me an example where you would use constant objects rather than normal ones? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone give me an example where you would use constant objects rather than normal ones?

2nd Jan 2017, 4:02 PM
MrDoomfighter
MrDoomfighter - avatar
2 Answers
+ 2
I have never seen constant objects yet, but for constant variables, this post has a great explanation http://www.cplusplus.com/forum/beginner/65076/ You could use a constant object in a similar way. Though no examples where you would want all of an object's properties unchangeable comes to mind.
2nd Jan 2017, 4:42 PM
Nsyse
Nsyse - avatar
+ 2
I believe enumerators would be a good example: they are a set of fixed values linked to their string rappresentation.. in other words.. constants!
2nd Jan 2017, 5:00 PM
Michael Isac Girardi
Michael Isac Girardi - avatar