Matlabでメソッドのオーバーライド

classdef testclass_method_override1
   
    properties
        h
    end
    
    methods
        function TC = testclass_method_override1(k, v)
            TC.h = containers.Map(k, v);
        end
        
        function okeys = keys(TC)
            okeys = keys(TC.h);
        end
        
        function ovalues = values(TC)
            ovalues = values(TC.h);
        end
        
        function v = subsref(TC, k_struct)
            if isequal({ k_struct.type }, { '()' })
               v = TC.h(k_struct.subs{1});
            else
               v = builtin('subsref', TC, k_struct);
            end 
        end
    end 
end

これで以下のような処理が可能。
>> tmph = testclass_method_override1({'A','B','C'},{1,2,3})

tmph = 

  testclass_method_override1

  Properties:
    h: [3x1 containers.Map]

  Methods

>> keys(tmph)

ans = 

    'A'    'B'    'C'

>> tmph.keys()

ans = 

    'A'    'B'    'C'

>> tmph('B')

ans =

     2

>>