面向对象
classdef Man < handleproperties(Access=private) scoreendpropertiesageheightendmethodsfunction obj = Man(inputArg1,inputArg2)obj.age = inputArg1 + inputArg2;endfunction outputArg = method1(obj,inputArg)outputArg = obj.age + inputArg;endfunction obj=grow(obj,inputArg)obj.age=obj.age+inputArg; endfunction obj=setScore(obj,inputArg)obj.score=inputArg;endfunction score=getScore(obj)score=obj.score;endend
end
classdef Person < ManpropertiesProperty1endmethodsfunction obj = Person(inputArg1,inputArg2,inputArg3)obj=obj@Man(inputArg1,inputArg2);obj.Property1 = inputArg3;endfunction outputArg = method1(obj,inputArg)outputArg = obj.Property1 + inputArg;endend
end