[Gambas-user] gb3: converting structures to classes

Jussi Lahtinen jussi.lahtinen at ...626...
Tue Feb 7 18:56:46 CET 2012


While structures and classes are different thing generally,
I have understand that structures are implemented to Gambas internally as
class.

And to answer Kevin's question.

Create class named Client_Animation, and paste this inside of it:

Public Animating As Boolean
Public OrientationDefault As Single
Public OrientationBegin As Single
Public OrientationEnd As Single
Public OrientationCurrent As Single
Public OrientationVelocity As Single
Public PositionDefaultX As Single
Public PositionDefaultY As Single
Public PositionBeginX As Single
Public PositionBeginY As Single
Public PositionEndX As Single
Public PositionEndY As Single
Public PositionCurrentX As Single
Public PositionCurrentY As Single
Public PositionVelocityX As Single
Public PositionVelocityY As Single

Then create class named Client_Gear, and paste this inside of it:

Public Orientation As Single
Public Scale As Single
Public SizeCap As Short
Public SizeStem As Short
Public Skin As Short
Public Type As Short
Public Animation As New Client_Animation

Or alternatively:

Inherits Client_Animation

Public Orientation As Single
Public Scale As Single
Public SizeCap As Short
Public SizeStem As Short
Public Skin As Short
Public Type As Short


Depends on what you want exactly to do...

Jussi




On Tue, Feb 7, 2012 at 17:06, Randall Morgan <rmorgan62 at ...626...> wrote:

> Well, it sounds like your issue is with the documentation rather than
> posters.
>
> I do recall someone a while back stating that in Gambas structures were
> implemented as method-less classes.
>
> In languages such as C/C++ etc.. structures are very different beasts
> compared to class. However, the documentation for gambas states, perhaps
> incorrectly, that they are nearly the same thing.  So I guess what is
> needed is better documentation....
>
>
>
> On Tue, Feb 7, 2012 at 5:50 AM, GMail <adamnt42 at ...626...> wrote:
>
> > 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
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Keep Your Developer Skills Current with LearnDevNow!
> > The most comprehensive online learning library for Microsoft developers
> > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> > Metro Style Apps, more. Free future releases when you subscribe now!
> > http://p.sf.net/sfu/learndevnow-d2d
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
> --
> If you ask me if it can be done. The answer is YES, it can always be done.
> The correct questions however are... What will it cost, and how long will
> it take?
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list