calling class into another class

31 views (last 30 days)
kanuri venkata mohana
kanuri venkata mohana on 8 Sep 2020
Answered: Rik on 24 Sep 2020
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 Comment
JAMMI ASHOK
JAMMI ASHOK on 24 Sep 2020
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.

Sign in to comment.

Answers (1)

Rik
Rik on 24 Sep 2020
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

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!