Re: [Vala] Override a "protected abstract method" as "private"
- From: Abderrahim Kitouni <a kitouni gmail com>
- To: Mike Massonnet <mmassonnet gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Override a "protected abstract method" as "private"
- Date: Sun, 19 Dec 2010 11:30:54 +0100
Hello,
في ح، 19-12-2010 عند 09:47 +0100 ، كتب Mike Massonnet:
Hi,
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 :-)
HTH,
Abderrahim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]