This is the method hiding:
class SuperClass : GLib.Object {
public void method1() {
stdout.printf("SuperClass.method1()\n");
}
}
class SubClass : SuperClass {
public new void method1() {
base.method1();
stdout.printf("SubClass.method1()\n");
}
}
And same code without "new" keyword:
class SuperClass : GLib.Object {
public void method1() {
stdout.printf("SuperClass.method1()\n");
}
}
class SubClass : SuperClass {
public void method1() {
base.method1();
stdout.printf("SubClass.method1()\n");
}
}
What is the difference between these?
edit: in the generated C code absolutely there is no difference, so I think the compiled binary is same.
There isn't any functional difference, however being explicit with the new
keyword is ideal and avoids the compiler warning.