I have a class which has a Private property httpSock as httpSocket.
The class has another public property Secure as Boolean.
What I want to do is if Secure is set to true I want httpSock to be a HTTPSecureSocket and if it is false httpSock to be HTTPSocket.
How can I achieve this?
Make Secure a computed property.
Of course… Dumb day… Thanks
Yes but what do I add httpSock my property as in the inspector. If I add it as a HTTPSocket can I change it to HTTPSecureSocket if the computed property Secure changes?
Norman_P
(Norman P)
April 29, 2014, 8:19pm
5
HTTPSecureSocket and then toggle whether that operates securely or not
A HTTPSecureSocket with Security = false should be the same as HTTPSocket.
Brilliant, didn’t know that could be done. Why have 2 classes then?
Tim_Hare
(Tim Hare)
April 29, 2014, 8:52pm
8
I have had issues with that where I had to revert back to a plain HTTPSocket. I will have to retest it however,
Tim_Hare
(Tim Hare)
April 29, 2014, 9:01pm
9
OK. The problem I had was Secure defaults to True and I wasn’t setting it False. It works. Thanks, I learned something new.