Re: [Vala] Chaining up to default implementations in Interface?
- From: Vlad Grecescu <b100dian gmail com>
- To: Andrea Del Signore <sejerpz tin it>
- Cc: Vala-list <vala-list gnome org>
- Subject: Re: [Vala] Chaining up to default implementations in Interface?
- Date: Thu, 21 May 2009 22:25:33 +0300
On Tue, May 19, 2009 at 1:47 AM, Andrea Del Signore
<sejerpz tin it> wrote:
On Mon, 2009-05-18 at 15:12 -0400, Feng Yu wrote:
> public interface Iface {
> public void function() {
> message("do somethign");
> }
> }
>
> public class Class:Object, Iface {
> public void function() {
> message("class do something");
> base.function();
> }
> }
Hi Yu,
the base keyword will chain the function call to the parent
class (which in this case is a GLib.Object) and not to any implemented
interface.
If you want to call the Iface.function member just use a cast like:
public void function() {
message("class do something");
((Iface) this).function ();
}
Regards,
Andrea
Interesting - I suppose this works because the function is not virtual?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]