[Gambas-user] gb3: converting structures to classes

Randall Morgan rmorgan62 at ...626...
Tue Feb 7 13:07:18 CET 2012


Actually, a Structure is a methodless class.



On Tue, Feb 7, 2012 at 12:46 AM, Kevin Fishburne <
kevinfishburne at ...1887...> wrote:

> On 02/06/2012 11:35 PM, nando wrote:
> > Quite easy.
> > Here's a suggestion/example
> >
> >
> >
> > Make a class called Tune...
> > ...Dim a bunch of privates for values (name, artist, date, genre)
> > ...Write SUBs for things to do with Tunes
> >
> >
> > In FMain...
> > PUBLIC Tunes AS Object[]
> >
> >
> >
> > In a SUB somewhere...
> > Dim newTune as NEW Tune( possible constructor information if you want)
> >
> > Tunes.Add( newTune)
> >
> > ---
> >
> > As long as Tunes[] points to class instances of Tune, they remain
> existing.
> >
> >
> > -Fernando
> >
> >
> >
> > ---------- Original Message -----------
> > From: Kevin Fishburne<kevinfishburne at ...1887...>
> > To: gambas-user at lists.sourceforge.net
> > Sent: Mon, 06 Feb 2012 22:58:46 -0500
> > Subject: Re: [Gambas-user] gb3: converting structures to classes
> >
> >> On 02/06/2012 09:36 AM, nando wrote:
> >>> I am doing the same thing.
> >>> Using class in place of structures.
> >>> Then arrays or collections of the classes.
> >>> Works great!
> >>>
> >> What are the general steps to do such a thing? How do you declare a
> >> class, define its properties, then create an array of the class? I'm
> >> starting to think it may be more complicated (or at least different)
> >> than with structures.
> >>
>
> Looks like a class is a structure with optional methods attached to
> procedures instead of just assignable properties. I'll play around with
> it and see if I can reproduce the structures as per your example. There
> should be a super simple project somewhere to show how classes work on a
> basic level. This is BASIC, so one can't presume people know what
> classes are. Thanks, classes look like they could be very useful.
>
> --
> Kevin Fishburne
> Eight Virtues
> www: http://sales.eightvirtues.com
> e-mail: sales at ...1887...
> phone: (770) 853-6271
>
>
>
> ------------------------------------------------------------------------------
> 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?



More information about the User mailing list