[Gambas-user] Class Constructor private var questions

Emil Lenngren emil.lenngren at ...626...
Mon Feb 13 22:28:04 CET 2012


2) The _new method is optional.
3) All instance variable assignments written at the declarations are done
before the _new method is executed.
1) These asignments are actually done in a special generated hidden method
called $new (which is executed before _new).

/Emil

2012/2/13 nando <nando_f at ...951...>

> I wanted to verify that..
>
>
> example:
> I have a class called 'X' with a private variable
>
>
> PRIVATE my_int AS INTEGER = -14
>
>
> PUBLIC SUB _NEW()    '===constructor===
>
>    my_int = -15
>
> END
>
>
> Questions:
> 1) The =-14 act as a constructor automatically for a _NEW instantiation?
> 2) The =-15 occur as a manual explicit contructor...and is unnecessary?
> 3) The _NEW() executes after the =-14 is assigned to the new private?
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> 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-dev2
> _______________________________________________
> 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