how to call a get.properties method in a script
Afficher commentaires plus anciens
Hi, I'm trying to use the get.propertie function on a private propertie.
classdef t_point2D
properties (Access = private)
X;
Y;
end
methods
%Defenir le constructeur
function point2D = t_point2D(X,Y)
if nargin == 0
point2D.X =0;
point2D.Y=0;
elseif nargin == 1 || nargin >2
fprintf('Error');
else
point2D.X = X;
point2D.Y = Y;
end
end
%accesseurs
function X = get.X(point2D)
X = point2D.X;
end
Then, I try to call it in a script :
point1 =t_point2D(2,8);
XX = get.X(point1);
I get the following error message : Undefined variable "get" or class "get.X".
Error in test (line 4) XX = get.X(point1);
I supposed I'm not calling the method the right way? I can't find the doc on how to call a get.prop function.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Argument Definitions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!