How the 'ONE' variable is considered a property(as it is said in one of the module)? There is no accessor here. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How the 'ONE' variable is considered a property(as it is said in one of the module)? There is no accessor here.

class MathClass { public const int ONE = 1; } static void Main(string[] args) { Console.Write(MathClass.ONE); } //Outputs 1

14th Oct 2020, 6:12 AM
Rohan Agarwal
Rohan Agarwal - avatar
3 Answers
+ 1
I think it would be more appropriate if we call it a constant 🤔
14th Oct 2020, 7:23 AM
Ipang
+ 1
I agree with you. This is not a property. It is a field. To be complete a const field. A property has a get- or a set- method or both.
14th Oct 2020, 4:48 PM
sneeze
sneeze - avatar
+ 1
Why you put C tag? C# and C is not the same, or even nearly related...
17th Oct 2020, 3:16 AM
LastSecond959
LastSecond959 - avatar