C# Properties : Fill in the blanks to create a read-only property X. The return value of the accessor should be the square of x. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

C# Properties : Fill in the blanks to create a read-only property X. The return value of the accessor should be the square of x.

class A { private int x=8; public int X { get { return x ____ x; } } }

16th Aug 2022, 4:43 PM
Mayooran Navamany
Mayooran Navamany - avatar
2 Answers
+ 3
you have to choose the operator that will give a squared value, I'll give you a hint, it's one of those: + * / -
16th Aug 2022, 5:33 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
class A { private int x=8; public int X { get { return x * x; } } }
17th Aug 2022, 1:13 AM
Mayooran Navamany
Mayooran Navamany - avatar