|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread|
|Messages 1 to 4 of 4 total|
|type MyDateTime = string|
|Mon, Apr 1 2019 5:27 AM||Permanent Link|
Is there anything that stops me defining one type to be based on another?
Obviously in classes you can do that, but can I say a new type is a string "underneath", while getting the type safety of classes?
(Related obviously to my datetime question, where I'd like to stop random strings getting copied in to my datetime properties).
|Mon, Apr 1 2019 9:50 AM||Permanent Link|
You may do that, but any string still be assignable to a variable of this new type.
|Mon, Apr 1 2019 10:29 AM||Permanent Link|
> You may do that, but any string still be assignable to a variable of this new type.
Thanks - better than nothing I guess.
|Thu, Apr 4 2019 10:49 AM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
<< Is there anything that stops me defining one type to be based on another? >>
No. As ooptimum points out, you will still be able to assign the base type to any variables/paramters that use the new type. This is true even if you define a new type instead of a type synonym:
TMyType = type String;