How do I add type checking to this class module? (OOP)

The examples you showed work different in how the constructor behaves, since in Rcade the constructor does not itself create the object, it only modifies the object that’s passed to it. So, properties can’t be dynamically created into a type using the constructor method as is. You would have to modify Rcade to create the object and return it within the constructor, and you would have to change how Rcade works from the inside.

One of my focuses on Rcade was to make the constructor as simple as possible. And call me crazy (I know I am) but I still like defining class properties (including object properties) outside of the constructor.

Good luck on your OOP endeavors!

1 Like