Debian Codegraph @

mcs/tests/gtest-autoproperty-12.cs

raw symbols SCIP
1 using System;
2
3 public class A
4 {
5 public int X { get; }
6 public virtual int Y { get; }
7
8 public A ()
9 {
10 X = 4;
11 X++;
12
13 Y = 2;
14 Y++;
15 }
16 }
17
18 class B : A
19 {
20 int i_get;
21
22 public override int Y { get { ++i_get; return base.Y; } }
23
24 public static int Main ()
25 {
26 var a = new A ();
27 if (a.X != 5)
28 return 1;
29
30 if (a.Y != 3)
31 return 2;
32
33 var b = new B ();
34 if (b.X != 5)
35 return 3;
36
37 if (b.i_get != 1)
38 return 4;
39
40 if (b.Y != 3)
41 return 5;
42
43 if (b.i_get != 2)
44 return 6;
45
46 return 0;
47 }
48 }