Re: [Vala] about property override.



Property which can be overriden is marked with `virtual` modifier in parent
class. In that case, you can override it by `override` modifier.

For instance,
  class Foo {
    public virtual int some { ... }
  }
  class Bar : Foo {
    public override int some { ... }
  }

If property doesn't have `virtual`, it means that the author of parent
class designed the property not to be overridable.
You can add a property having same name by `new` and shadow original
property, but internal methods in parent class won't refer to your new
property, but to original one.


2018-06-18 1:21 GMT+09:00 readon shaw <xydarcher 163 com>:

When I inherit from GTK widget, I want to override inherited property, so
that the normal operation will not be affected. However I could not find
any material or tutorials describing it.


when I tried to override property, it seems the compiler will report the
error.
but using the keyword reported, 'new', I think it means a totally new
property, not override.


is there any example can explain the way it should be?
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



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