Re: [Vala] Implementing interface methods



On Don, 2006-08-24 at 11:46 +0200, Dominique Würtz wrote:
here is another thing I did not get to work: Implementing a method of an 
interface.

public interface MyInterface {
    public void foo ();
}

public class MyClass : MyInterface {
    public void foo () {
    }
}

Compiling works, however the _interface_init() function stays empty.

As interfaces in GObject may have non-abstract methods, you have to make
the declarations more explicit. Something like the following should work

public interface MyInterface {
        public abstract void foo ();
}

public class MyClass : MyInterface {
        public override void foo () {
        }
}

Interfaces in the generated bindings don't have proper method
declarations yet, I hope to get that resolved as soon as possible.

Regards,

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]