[Gambas-user] difference ME and SUPER with inherit
Mayost Sharon
sharon at 455.co.il
Fri Mar 10 06:07:59 CET 2023
Hello
Thank you very much
Now I was able to understand.
If I did me.clear I got: STACK OVERFLOW because it entered an infinite loop.
It takes time but eventually I understand.
Many thanks again
---------- Original Message -----------
From: Bruce Steers <bsteers4 at gmail.com>
To: Gambas Mailing List <user at lists.gambas-basic.org>
Sent: Thu, 9 Mar 2023 20:12:28 +0000
Subject: Re: [Gambas-user] difference ME and SUPER with inherit
> On Thu, 9 Mar 2023 at 19:05, Mayost Sharon <sharon at 455.co.il> wrote:
>
> > Hello
> >
> > Yes I am this Gambas-user
> > To learn from you
> >
> > But when I try to run the sample it gives an error
> > (I am attaching the sample file "super2.tar.xz" again) for me it gives an
> > error
> > Can you fix the error for me?
> > And so I can study well
> >
> > You helped me a lot when you wrote "recursion loop"
> > If I understood correctly, in the "Clear" part of the example it doesn't
> > matter if we use ME or SUPER
> > ' Reimplements the Clear method
> > public Sub Clear()
> > Super.Clear
> > $aKey.Clear
> > $cValue.Clear
> > End
> >
> > Many thanks again to all the helpers
> >
>
> Aaah It seems the example in the wiki is wrong :-\
>
> Like I said you must match the arguments
> the example adds a "Key" arg to the Add method and that is wrong.
>
> And it seems you did not understand at all.
> if you run Me.Clear() in the classes Clear() method it will loop ,
> Me.Clear() IS Clear()
>
> Public Sub Clear()
> Me.Clear()
> End
>
> Is the same as,,,
> Public Sub Clear()
> Clear()
> End
>
> You must understand..
> The class has inherited another class so it has all it's properties/methods
> by default. (Me.)
> Any properties/methods you are *NOT* overriding you can use Me.
> you will see the inherited classes objects.
>
> if you *HAVE* made your own override for a property/method then using Me.
> will be your own override not the inherited class. You will use Super. to
> access the inherited objects.
>
> Does that make sense?
> BruceS
------- End of Original Message -------
More information about the User
mailing list