+ 3

Why create a static field for a static property? Isn't it enough just to state that the property is static?

1st Apr 2022, 11:13 AM
â€ŽŰŁÙ†ŰŻŰ±ÙŠÙ‡â€Ž
â€ŽŰŁÙ†ŰŻŰ±ÙŠÙ‡â€Ž - avatar
2 Answers
+ 2
As I understand it, static members (class bound members) can only make use of other members that are also defined as static.
1st Apr 2022, 1:01 PM
Ipang
+ 1
A static property is a property not a const. The advantage of having a getter and a setter is being able to validate the value before accepting it. You can assign any value to a field. If you have a property you can validate if you want to accept this new value.
2nd Apr 2022, 11:47 AM
sneeze
sneeze - avatar