让我们有一个抽象类:在Matlab使用抽象类(无属性)
classdef ACalculation < handle
methods (Abstract)
[result] = calculate (this, data);
plot (this, data, limX, limY);
end
end
和实现ACalculation
classdef Maximum < ACalculation
methods
function [result] = calculate (this, data)
%...
end
function plot (this, data, limX, limY)
%...
end
end
要实现类的功能的一些其他类我给所有需要的信息,所以我不需要任何属性。 所以它看起来像我需要静态类。但是,如果我有静态类,我有一个调用这个函数的问题。 我想要做这样的事情:
criteria = Maximum();
%......
result = criteria.calculate(data);
是否使用继承坏的方式? 我应该忽略matlab建议将功能更改为静态? 我还能在这里做什么?
它的工作原理,谢谢! – Lex 2012-03-20 15:24:33