calling class into another class

30 visualizaciones (últimos 30 días)
kanuri venkata mohana
kanuri venkata mohana el 8 de Sept. de 2020
Respondida: Rik el 24 de Sept. de 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 comentario
JAMMI ASHOK
JAMMI ASHOK el 24 de Sept. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Rik
Rik el 24 de Sept. de 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

Categorías

Más información sobre Construct and Work with Object Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by