Tôi có một lớp học Super mà tôi đã thực hiện một số tài liệu mở rộng. Có các lớp con kế thừa từ lớp siêu này và tôi muốn sử dụng lại tài liệu của siêu nếu có thể. Ví dụ với Super lớp ClassA
:Làm cách nào để kế thừa tài liệu từ các lớp siêu trong Matlab?
classdef ClassA
%CLASSA Super Class for all others classes
%
% CLASSA Properties:
% Prop1 It's the first property
% Prop2 It's the second
%
% CLASSA Methods:
% Method1 It's a method
% Method2 It's another method
function value = Method1(var)
% Super implementation of Method1
end
% Other method definitions follow
end
Và một lớp con, ClassB:
classdef ClassB < ClassA
%CLASSB Subclass of super class CLASSA
%
% CLASSB Properties:
% Prop3 It's the first property of subclass
%
% CLASSB Methods:
% Method 3 It's the first method of subclass
function value = Method1(var)
% Subclass implementation of Method1
end
% Other method definitions follow
end
Nếu tôi gõ help ClassB
tôi chỉ nhận được ClassB
's mô tả sự giúp đỡ. Tôi muốn có mô tả trợ giúp của Super cũng được đưa vào. Kết quả sẽ trông giống như sau:
CLASSB Subclass of super class CLASSA
CLASSB Properties:
Prop1 It's the first property
Prop2 It's the second
Prop3 It's the first property of subclass
CLASSB Methods:
Method1 It's a method
Method2 It's another method
Method3 It's the first method of subclass
Có cách nào để thực hiện việc này không?
Tôi không nghĩ rằng có thể thực hiện việc này; tuy nhiên, bạn có thể bao gồm "xem cũng" sẽ tự động liên kết với lớp học siêu của bạn; chỉ cần đặt 'Xem thêm CLASSA.' vào cuối tài liệu' ClassB' của bạn và MATLAB sẽ làm phần còn lại. – wakjah
Tôi không biết về điều này. Điều đó rất thông minh. – KronoS