[Vala] enum in a subclass
- From: Виталий Кирсанов <krokoziabla gmail com>
- To: vala-list gnome org
- Subject: [Vala] enum in a subclass
- Date: Fri, 7 Nov 2014 18:10:02 +0400
Hello, list.
I'm a newbie, want to write an application in vala. Please consider the
following code snippet:
public interface foo
{
public enum Type
{
a, b
}
public abstract Type get_type();
}
public class bar : foo
{
Type t = Type.a; // OK
public override Type get_type() { return t; } // NOK!!!
}
If I declare a field Type t in class bar that's ok. But valac reports the
following error on the overloaded method:
test.vala:14.6-14.34: error: overriding method `bar.get_type' is
incompatible with base method `foo.get_type': incompatible return type.
public override Type get_type() { return t; } // NOK!!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.vala:14.6-14.34: error: bar.get_type: no suitable method found to
override
public override Type get_type() { return t; } // NOK!!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 2 error(s), 0 warning(s)
How do I override get_type() method properly?
BR, Vitaly Kirsanov
skype: vkirsan
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]