I'm new to Matlab and am facing some problems with calling superclass methods.
I've got this code:
Superclass test1:
classdef test1 < handle
methods
function obj = test1()
end
function test2(obj)
disp(1);
end
end
end
Subclass test:
classdef test < test1 & handle
properties
foo = 1;
end
methods
function obj = test()
obj = obj@test1();
end
function a = bar(obj)
superclasses(obj)
test2@test1(obj)
end
end
end
The inheritance works correctly; the superclasses function shows test1
as a superclass of test
. However, when I call test2@test1(obj)
, it returns an error:
"@" Within a method, a superclass method of the same name is called by saying method@superclass. The left operand of "@" must be the method name.
The test
2 method obviously exists within the superclass test1
, so I'm not sure what exactly is going wrong.