I have a class:
classdef fast_calc < handle
function obj = fast_calc(x)
the function sin works fine on a fast_calc object:
>> myNum = fast_calc(pi/6);
However, I would like also to be to call it directly on a standard numeric variable, something like:
but this returns an error
The class fast_calc has no Constant property or Static method named 'sin'.
I don't want to define 'sin' as a static method because then sin(myNum) will not automatically invoke the overloaded function.
Is there a solution which allows calling an overloaded method both automatically on an instance, and on other object types when explicitly requesitng it?