GVala added.

This commit is contained in:
Kolan Sh 2012-10-12 20:24:44 +04:00
parent 8b1fea5f14
commit 40334d814c
1 changed files with 10 additions and 20 deletions

View File

@ -1,32 +1,22 @@
class AAA : GLib.Object { class Base : GLib.Object {
public int vala; public virtual void copy () {
stdout.printf ("Base copy() called\n");
public virtual void copy (AAA a) {
a.vala = this.vala;
} }
} }
class subAAA : AAA { class Sub : Base {
public int sub_vala; public override void copy () {
stdout.printf ("Sub copy() called\n");
public virtual new void copy (subAAA a) {
((AAA)this).copy(a);
a.sub_vala = this.sub_vala;
} }
} }
class GVala : GLib.Object { class GVala : GLib.Object {
public static int main (string[] args) { public static int main (string[] args) {
var suba = new subAAA(); // var base = new Base();
suba.vala = 1; // var sub = new Sub();
suba.sub_vala = 2; Base b = new Sub();
var subb = new subAAA(); b.copy();
suba.copy (subb);
stdout.printf ("{%d;%d}\n", suba.vala, suba.sub_vala);
stdout.printf ("{%d;%d}\n", subb.vala, subb.sub_vala);
return 0; return 0;
} }