oop - Chain up to 'Gtk.Box.new' not supported -


i'm new vala , far think it's pretty cool i'm having trouble understanding inheritance. read here should use base() call parents constructor. alright, cool, seems understandable din't work me. kept getting error on title. here snippet show:

public class mybox : gtk.box {     public mybox(gtk.orientation orientation, int spacing) {         // have         this.set_orientation(orientation);         this.set_spacing(spacing);         // want this:         base(orientation, spacing);         //workaround this:         object(orientation: orientation, spacing: spacing);     } } 

please me understand why object(....) works not base(...)

shouldn't same thing?

this due implementation of c code. when vala generates constructor, generates 2 c functions _new function allocates memory , calls _construct , _construct function initialises object. when case base constructor using base(), needs matching _construct function call. not classes written in c have this; in vapi file, find has_construct_function = false constructors. if case, no chain-up can done. base gobject can set properties arguments, becomes way set defaults in base class.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -