6 ms·
At compile time? It's very simple–use an interface and provide constructor functions that upcast object instances to the interface. Now, only the interface-defi
by yawaramin 7y ago
At compile time? It's very simple–use an interface and provide constructor functions that upcast object instances to the interface. Now, only the interface-defined members i.e. the public members are accessible.
At runtime? You can't, it's JavaScript, everything is public (for now at least).