[Gambas-user] Problems with controls - text property
ron
ronstk at ...239...
Fri Apr 27 01:07:55 CEST 2007
On Friday 27 April 2007 00:52, Benoit Minisini wrote:
> On vendredi 27 avril 2007, ron wrote:
...........
> >
> >
> > Ron
> >
>
> Hmm... It is absolutely not that :-)
>
> The Name property has been implemented for a while.
Many thanks, got bless you :) :) :)
Shame to me, I miss the announcement of it.
>
> The problem is that Steven didn't understand that if *he* knows that his test
> is true only for control having the Text property, Gambas does not.
>
> Gambas uses static typing with virtual dispatching.
>
> 'Static typing' means that the class of an object is given by the declaration
> of the variable that contains its reference.
>
> 'Virtual dispatching' means that the symbol (method or property) applied to
> this reference will call the implementation of the true object class, not the
> class given by the declaration of the variable.
>
> So if the 'ctrl' variable is declared 'AS Control', then you can only use
> symbols of the Control class on it.
>
> If you want Gambas to use dynamic typing, i.e. detects that the Text property
> exists each time it uses it, then you must declare the 'ctrl' variable 'AS
> Object'. But this is slower, as each symbol applied to 'ctrl' will need a
> lookup in the symbol table of the object class.
>
> I hope I was clear, as it is difficult for me to explain that in English.
>
> Note that is exactly like C++, with classes having virtual methods only.
> Except that C++ has no dynamic typing of course.
>
> Regards,
>
I do believe I understand.
Your explanation about static and virtual here is for me clear ATM.
Thanks
Ron
More information about the User
mailing list