Re: [Vala] Override a "protected abstract method" as "private"

                  في ح، 19-12-2010 عند 09:47 +0100 ، كتب Mike Massonnet:

I hope the subject is not too missleading :)

I have the following method in a base class:
  protected abstract void method();

which I'm implemented in a sub-class like this:
  private override void method () { }

There is a compilation issue with vala-git:
error: Private member `Xnp.TitleBarButton.draw_icon' cannot be marked
as override, virtual, or abstract

Why would this fail, as it currently works fine with Vala 0.10?
private doesn't make sense in virtual methods : a virtual method can be
overridden and called (to allow for chaining up) by a subclass, and
should thus be protected if not public. An overriding method has the
same behavior : a subclass can always chain up to the base class'
implementation, which thus cannot be private.

As for why valac 0.10 doesn't report an error, it's a "known problem" :
nobody thought about this at the time :-)


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