[Gambas-user] gb3: converting structures to classes

GMail adamnt42 at ...626...
Tue Feb 7 14:50:22 CET 2012


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
 





More information about the User mailing list