linux-packaging-mono/mcs/tests/gtest-autoproperty-12.cs
Jo Shields 3c1f479b9d Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
2015-04-07 09:35:12 +01:00

49 lines
504 B
C#

using System;
public class A
{
public int X { get; }
public virtual int Y { get; }
public A ()
{
X = 4;
X++;
Y = 2;
Y++;
}
}
class B : A
{
int i_get;
public override int Y { get { ++i_get; return base.Y; } }
public static int Main ()
{
var a = new A ();
if (a.X != 5)
return 1;
if (a.Y != 3)
return 2;
var b = new B ();
if (b.X != 5)
return 3;
if (b.i_get != 1)
return 4;
if (b.Y != 3)
return 5;
if (b.i_get != 2)
return 6;
return 0;
}
}