GVala added.
This commit is contained in:
parent
fd13b54b6a
commit
5fda726171
|
@ -1,29 +1,47 @@
|
|||
class Base : GLib.Object {
|
||||
public int b;
|
||||
|
||||
public virtual void copy_from (Base b) {
|
||||
public new void copy_from (Base b) {
|
||||
stdout.printf ("Base copy_from() called\n");
|
||||
this.b = b.b;
|
||||
}
|
||||
|
||||
public virtual Base clone () {
|
||||
var b = new Base();
|
||||
b.copy_from (this);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
class Sub : Base {
|
||||
public int s;
|
||||
|
||||
public override void copy_from (Base b) {
|
||||
public new void copy_from (Base b) {
|
||||
stdout.printf ("Sub copy_from() called\n");
|
||||
((Base)this).copy_from(b);
|
||||
this.s = ((Sub)b).s;
|
||||
}
|
||||
|
||||
public override Base clone () {
|
||||
var b = new Sub();
|
||||
b.copy_from (this);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
class SubSub : Sub {
|
||||
public int ss;
|
||||
public int s;
|
||||
|
||||
public override void copy_from (Base b) {
|
||||
public new void copy_from (Base b) {
|
||||
stdout.printf ("SubSub copy_from() called\n");
|
||||
((Sub)this).copy_from(b);
|
||||
this.ss = ((SubSub)b).ss;
|
||||
//((Sub)this).copy_from(b);
|
||||
}
|
||||
|
||||
public override Base clone () {
|
||||
var b = new SubSub();
|
||||
b.copy_from (this);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +53,7 @@ class GVala : GLib.Object {
|
|||
src.ss = 3;
|
||||
|
||||
Base b = new SubSub();
|
||||
b.copy_from(src);
|
||||
b = src.clone();
|
||||
|
||||
var ss = (SubSub) b;
|
||||
|
||||
|
|
Loading…
Reference in New Issue