Are you familiar with how to include an operator in an object (rather than the entire class)? When it comes to a method, I know you can achieve that by:
my_object.new_function = function(){return 1};
Then invoking my_object.new_function()
will output 1
.
However, what I'd like to do is apply the get
operator to access my_object.new_function
directly instead of using my_object.new_function()
.