On Thu, 18 Aug 2016, PICCORO McKAY Lenz wrote: > i have a global variable: > > Private varaible As New Collection > > this declaration has a inline instanciation due the keyword "New" in the > same line > > whats the difference if i done as: > > private variable as Collection > > and later inside funtion: > > variable = New Collection > > Please! answer me! >
The first way ensures that the variable contains a valid reference to a Collection object as soon as an object of the class you're writing is instantiated. This happens even before the constructor of that object is called. In the second case there is certainly an interval in the life of your object when the variable is Null and accessing it somewhere in your code will lead to an error. Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user