Re: [Vala] Interfaces and Mixins



On Sat, Jun 12, 2010 at 7:03 AM, tecywiz121 <tecywiz121 hotmail com> wrote:

Hey,


Hey!



The following code won't compile unless I create a flush() in Concrete,
but I can't seem to access Entity.flush() at all, any way around this
that doesn't involve making Entity a class?
public interface Flushable : Object

{
   public abstract void flush();
}

public interface Entity : Object, Flushable
{
   public virtual void flush()
   {
       // Do Something
   }
}



What are you trying to accomplish by having both Flushable and Entity?  I
think you are trying to create different mixin implementations of Flushable,
which seems like a perfectly reasonable thing to do.

You can access Entity.flush by casting this to an Entity.  I think you'll
find that when you refer to the object you will receive GObject warnings
about cannot add interface type 'Entity'.  Even without the name collision
of flush, this GObject warning will still occur.

Deriving interfaces from interfaces is definitely broken.  You might want to
submit a bug.

Hope that helps,

Rob


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