[Gambas-user] Class startup?

Fabien Bodard gambas.fr at ...626...
Fri May 19 09:34:53 CEST 2017


2017-05-18 17:39 GMT+02:00 PICCORO McKAY Lenz <mckaygerhard at ...626...>:
> 2017-05-18 11:23 GMT-04:00 Tobias Boege <taboege at ...626...>:
>
>> Yes, they can be optional.
>>
>> If you use optional constructor arguments you have to be careful with
>> inheritance, though! Along the inheritance lineage, all constructor
>> arguments are divided into two camps: mandatory and optional arguments.
>> When the final inherited constructor signature is computed, both camps
>> are sorted separately with the elders' arguments first and then all the
>> mandatory arguments precede the optional arguments, e.g.
>>
>>   ' Parent.class
>>   Public Sub _new(ParentArg, ParentArg2, Optional ParentOpt)
>>
>>   ' Child.class
>>   Inherits Parent
>>   Public Sub _new(ChildArg, Optional ChildOpt)
>>
>> results in the following complete signature for Child._new():
>>
>>   _new(ParentArg, ParentArg2, ChildArg, ParentOpt, ChildOpt)
>>
> the signature now takes all the parameters?
>
> umm seems now teste in gambas, the args of the child are alway behind of
> the parents
>
> but if the child have no args? the childs of childrens must have parent1
> and 2?

Yes... it's the principe behind the class control for example.

every inheritance of control must to have a container parent because
they inherit from the control class.

But you can avoid that by embedded an internal instance of the desired
control in a new class that give a new api without _new parameters
(encapsulation)


>
>
>>
>> Note that the optional argument of the parent comes *after* the mandatory
>> argument of the child. There is an extra section in the object model wiki
>> page about this [1].
>>
>> Regards,
>> Tobi
>>
>> [1] http://gambaswiki.org/wiki/doc/object-model#t18
>>
>> --
>> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard




More information about the User mailing list