[Gambas-user] More on overriding native classes

Bruce bbruen at ...2308...
Mon Jun 25 10:33:41 CEST 2012


On Mon, 2012-06-25 at 00:47 +0200, Benoît Minisini wrote:
> Le 25/06/2012 00:41, Bruce a écrit :
> >>
> >> If you export a class with a name that already exists, it automatically
> >> implies inheritance with overriding.
> >>
> >> So you have a "multiple inheritance" error by using the "Inherits" keyword.
> >>
> >
> > Wow! That simple.
> > Now I can do all those nefarious things I've always wanted :-)
> >
> > Oh, but wait, one question.
> >
> > Class initialisation must occur in some specific order (like
> > constructors and inherited classes), what is it and is there any way to
> > control it? e.g. by the order of the components and libraries in
> > the .startup file?
> >
> > Bruce
> >
> 
> The only rule if that a class is initialized the first time it is needed.
> 
OK, but not the answer I was hoping for.

Presumably "Application" is needed early on in the piece.  What I'm
trying to work out is, if I override Application then which order does 
        
        gb.Application._Init()
               ^
               |
        gb.qt4.Application._Init()
               ^
               |
        (my) Application.Init()

get executed.

Why? Because my override is dependent on some of the gb.Application
statics. Therefore I need it to execute "after" the
gb.Application._Init, so that I can access these static properties
without having to implement a late static "StartMeUp" method in my
project's Main method to set the static Properties I want.

What's even worse is that what I really,really want is
my.Application._Init to be executed after some gb.db.***._Init()'s  have
occurred.  But I think that is not possible.

If you could just clarify the execution order of the inheritance chain
_Init()'s I might find a way around the (nefarious) things I'm trying to
do?

Bruce









More information about the User mailing list