CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

A Simple Class

C# code walkthrough · Question 46
mediumClasses

Code

Read carefully. What does this print?
1var c = new Counter();
2c.Inc();
3c.Inc();
4c.Inc();
5Console.WriteLine(c.Count);
6 
7class Counter
8{
9 public int Count = 0;
10 public void Inc() => Count++;
11}

Your answer