Is the Abstract keyword needed to make a method abstract?
1 次查看(过去 30 天)
显示 更早的评论
Is this correct Matlab syntax
classdef MyClass
methods
outarg = my_method( this, inarg );
end
end
R2018b accepts it. Assuming this class definition is correct
- is MyClass abstract?
- is the method, my_method, abstract?
meta.class reports that .Abstract==false for both.
采纳的回答
Steven Lord
2021-9-18
That is valid syntax, but not for making my_method an Abstract method. What you've written tells MATLAB that my_method is implemented in a separate file, not in the classdef file for MyClass.
classdef MyClass
methods (Abstract)
outarg = my_method( this, inarg );
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!