Re: [Vala] Virtual methods in interfaces



Hi,
                   في ث، 25-01-2011 عند 21:35 +1030 ، كتب James Moschou:
Is is possible to mark methods as virtual in interfaces, as a
mechanism of providing default implementations?

If I do

interface Interface {
 public virtual void function () {
   // Default
 }
}

class Class : Object, Interface {
 public override void function () {
   // Custom
 }
}

The compiler says that no method to override was found.

but if you remove the override keyword, it works ;-)

So now the question is : is this intentional? I always thought that you
don't need override when implementing an abstract method (and need
override when there is already an implementation), but it seems I was
wrong. This probably needs an answer from Jürg (and the rationale to be
added somewhere in the documentation).

HTH,
Abderrahim




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