sub new or functions to initialise a class * RESOLVED but vote if you wish*
I am in the process of designing a class.
I can either write an overloaded function to initialise a class or I can overload sub new.
The advantage of the function is I can return a value indicating whether the initilaisation was successful.
The disadvantage is the function will have to be called every time a new instance of the class is created. With sub new the initialisation parameters are in the dimentialisation (dim) statement.
What do you reckon
Re: sub new or functions to initialise a class
[list=1][*]A function (with parameters passing in the initialisation values) can return a value e.g. boolean to indicate success. A sub cannot[*]The function would need to be called for each class instance. For sub new it would not. The parameters to the sub new would pass in the intialisation values.[/list=1]