constant objects | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

constant objects

Why would I want to create a constant object? If I can't change any of its values wouldn't it be useless?

6th Aug 2016, 5:50 PM
Donatas Vaiciukevičius
Donatas Vaiciukevičius - avatar
2 ответов
+ 1
Let me ask you a question: Why are there constants in mathematics? Do they make sense there?
6th Aug 2016, 7:50 PM
Stefan
Stefan - avatar
+ 1
@Donatas: Ok, so I thought I would maybe elicit an answer from you by now. Nevertheless, here's where constants are used: constants usually represent "given" values that are not "for discussion". In programming these are e.g. default values, natural constants from physics, fixed system values as file names to load, how many times to attempt to reconnect to servers, timeouts etc.
7th Aug 2016, 8:06 PM
Stefan
Stefan - avatar