test-009.vala 757 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
using GLib;

class Maman.Foo {
	private int _public_base_property = 2;
	public int public_base_property {
		get {
			return _public_base_property;
		}
		set {
			_public_base_property = value;
Raffaele Sandrini's avatar
add  
Raffaele Sandrini committed
11 12 13 14
		}
	}
}

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
class Maman.Bar : Foo {
	private int _public_property = 3;
	public int public_property {
		get {
			return _public_property;
		}
		set {
			_public_property = value;
		}
	}
	
	void do_action () {
		stdout.printf (" %d %d", public_base_property, public_property);
		public_base_property = 4;
		public_property = 5;
		stdout.printf (" %d %d", public_base_property, public_property);
	}

33
	static int main (string[] args) {
34 35 36 37 38 39 40 41 42 43
		stdout.printf ("Property Test: 1");
		
		var bar = new Bar ();
		bar.do_action ();
		
		stdout.printf (" 6\n");
		
		return 0;
	}
}