Re: [Vala] Genie, subclassing and some help!



Hi,

2010/6/24, Andrew <rugby471 gmail com>:
Hi guys,

 I am a programmer coming form python and I am trying to get to grips
 with Genie. One problem I am having is as follows:

 Say I have a class called Gerrard and to create a new version of this
 class, I use the following:

 var g = new Gerrard(arg1, arg2, arg3)

 Now I wish to subclass Gerrard, into the class Terry. However I wish to
 be able to create a new version of Terry as follows:

 var t = new Terry(arg1, arg2, arg3)

 How do I do this in Genie?
it's as simple as
construct (arg1: type1, arg2: type2, arg3: type3)
    super(arg1, arg2, arg3)

BUT this won't work if the base class isn't defined in vala, in which
case you'll need to find the properties initialized by the creation
method (usually the same as the arg name) and chain up to GLib.Object
directly, something like (untested) :

construct (arg1: type1, arg2: type2, arg3: type3)
    Object(arg1: arg1, arg2: arg2, arg3: arg3)

HTH,
Abderrahim



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