calling class into another class

조회 수: 31 (최근 30일)
kanuri venkata mohana
kanuri venkata mohana 2020년 9월 8일
답변: Rik 2020년 9월 24일
Hi guys,
Is there any way to call a class into another class. If so could anyone give me a small example. I want to call the complete class with indenpendent and dependent properties
thankyou
  댓글 수: 1
JAMMI ASHOK
JAMMI ASHOK 2020년 9월 24일
What do you mean by 'calling'?
You can inherit a class to another class - create an object to child class - and using that object access the parent class attributes.

댓글을 달려면 로그인하십시오.

답변 (1개)

Rik
Rik 2020년 9월 24일
Here is an example from the documentation:
classdef PositiveDouble < double
methods
function obj = PositiveDouble(data)
if nargin == 0
data = 1;
else
mustBePositive(data)
end
obj = obj@double(data);
end
end
end

카테고리

Help CenterFile Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by