[Gambas-user] gb3: converting structures to classes
Benoît Minisini
gambas at ...1...
Tue Feb 7 20:29:41 CET 2012
Le 07/02/2012 14:50, GMail a écrit :
> On Tue, 2012-02-07 at 05:07 -0800, Randall Morgan wrote:
>> Just restating the documentation....
>>
>> On Tue, Feb 7, 2012 at 5:05 AM, Bruce Bruen<bbruen at ...2308...> wrote:
>>
>>> On Tue, 2012-02-07 at 04:07 -0800, Randall Morgan wrote:
>>>> Actually, a Structure is a methodless class.
>>> ggggzzzzzrrpppppppp!
>>>
>>> ... and you can inherit from, override and make static attributes from a
>>> struct too?
>>>
>>> Please, lets keep things realistic here
>
> No, I don't think "A structure is exactly like a class that would have
> only public variables" is the same thing as saying that a "Structure is
> a methodless class".
>
> In fact, I would almost go further and say that the help should say that
> a "structure is somewhat like a class, in that it exposes attributes
> publicly (and in an unprotected manner) but it neither contains nor
> exposes any functionality or feature typically associated with the
> generally understood concept of an OO classifier."
>
> A class can inherit from any other gambas class (with one notable
> exception - Form), it can have a constructor, destructor, initialisation
> and finalization code and other special methods, it can have both
> exposed (public or property based) data, it can contain specifically
> differential static data, classes can override the methods of their
> parent classes etc etc.
>
> I'm not having a go at you, its just that there is a bunch of mail
> lately that seems to imply that a class is just a "fancy" structure. In
> my opinion, it's quite different; a structure is just a "chunk of data",
> conversely a class is much much more than that. Comparing the two is
> like comparing penguins and pineapples.
>
> cheers
> Bruce
>
Gambas structures are really Gambas objects, except that they can be
embedded inside other objects or structures (you cannot embed a Gambas
object inside another one).
Beside that special behaviour (and two other ones in extern function
management and stream management), Gambas makes no difference between a
structure object and a normal object.
And I have never tested inheritance and structure... Maybe not a good
idea. :-)
Otherwise, to get the real details, you have to read the interpreter
source code! :-)
Regards,
--
Benoît Minisini
More information about the User
mailing list