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
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to