classdef B
  properties
    foo
  end
  methods
    function f = B(val)
      f.foo = val;
    end
    function h = plus(f, g)
      disp('called B::plus')
      h = 2*f.foo + g.foo;
    end
  end
end
