From 8b1fea5f1495ab48f365ac5ced4f882bfcafa9e9 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 12 Oct 2012 20:04:37 +0400 Subject: [PATCH] GVala added. --- vala/gvala/gvala.vala | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/vala/gvala/gvala.vala b/vala/gvala/gvala.vala index b76e1d9..251e8fe 100644 --- a/vala/gvala/gvala.vala +++ b/vala/gvala/gvala.vala @@ -1,21 +1,17 @@ class AAA : GLib.Object { public int vala; - public virtual AAA clone () { - var a = new AAA(); + + public virtual void copy (AAA a) { a.vala = this.vala; - return a; } } class subAAA : AAA { public int sub_vala; - public virtual new subAAA clone () { - var a = new subAAA(); - + public virtual new void copy (subAAA a) { + ((AAA)this).copy(a); a.sub_vala = this.sub_vala; - - return a; } } @@ -25,7 +21,8 @@ class GVala : GLib.Object { suba.vala = 1; suba.sub_vala = 2; - var subb = suba.clone(); + var subb = new subAAA(); + suba.copy (subb); stdout.printf ("{%d;%d}\n", suba.vala, suba.sub_vala);