Cool idea for object New initialization defaults
Posted
#1
(In Topic #1003)
Guru

I added this for my _new() method…
the class in question is called ExternalTool.class and has these properties…
Property Text As String Use $sText
Property SaveBefore As Boolean Use $bSaveBefore
Property UseTerminal As Boolean Use $bUseTerm
Property Mode As Integer Use $bMode
Property CopyToClipboard As Boolean Use $bCopyToClip
New with that _new() method i am free to configure any and all properties upon initializing.
Like this..
That just struck me as very useful and worth sharing.
It saves adding lots of individual optional parameters to the _new() method
Posted
Regular

What happens if you give it a property that does not exist?
The way I have always done this type of thing is via a static "Create" method. i.e.
(if that is in anyway clear?)
rgrds
b
1 guest and 0 members have just viewed this.


