3 public class Sample
: Object
{
4 private string automatic
{ get; set; }
12 private string _read_only
;
13 public string read_only
{
14 get { return _read_only
; }
17 public Sample (string name
) {
22 _automatic
= "InitialAutomatic";
23 _read_only
= "InitialReadOnly";
28 stdout
.printf("property `%s' has changed!\n",
33 automatic
= "TheNewAutomatic";
36 // The following statement would be rejected
37 // read_only = "TheNewReadOnly";
39 stdout
.printf("automatic: %s\n", automatic
);
40 stdout
.printf("name: %s\n", name
);
41 stdout
.printf("read_only: %s\n", read_only
);
42 stdout
.printf("automatic: %s\n", automatic
);
45 public static int main () {
46 var test
= new
Sample("InitialName");
52 stdout
.printf ("Interface Properties Test: 1");
54 Maman
.Ibaz ibaz
= new Maman
.Baz ();
55 ibaz
.simple_method ();
57 stdout
.printf (" 3\n");
63 abstract class Maman
.Foo
: Object
{
64 private int _public_base_property
= 2;
65 public int public_base_property
{
67 return _public_base_property
;
70 _public_base_property
= value
;
73 public abstract int abstract_base_property
{ get; set; }
76 class Maman
.Bar
: Foo
{
77 public int public_property
{ get; set; default = 3; }
78 public override int abstract_base_property
{ get; set; }
81 stdout
.printf (" %d %d", public_base_property
, public_property
);
82 public_base_property
= 4;
84 stdout
.printf (" %d %d", public_base_property
, public_property
);
87 public static void run () {
88 stdout
.printf ("Property Test: 1");
94 foo
.abstract_base_property
= 6;
95 stdout
.printf (" %d", foo
.abstract_base_property
);
97 stdout
.printf (" 7\n");
101 interface Maman
.Ibaz
: Object
{
102 public abstract int number
{ get; }
104 public void simple_method () {
106 stdout
.printf (" %d", n
);
110 class Maman
.Baz
: Object
, Ibaz
{