...
This commit is contained in:
parent
051504d65b
commit
0457928c3e
295 changed files with 3588 additions and 3 deletions
28
Task/Classes/MATLAB/classes-6.m
Normal file
28
Task/Classes/MATLAB/classes-6.m
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
classdef GenericClass2
|
||||
|
||||
properties
|
||||
classVariable
|
||||
end %properties
|
||||
|
||||
methods
|
||||
|
||||
%Class constructor
|
||||
function objectInstance = GenericClass2(varargin)
|
||||
if isempty(varargin) %No input arguments
|
||||
objectInstance.classVariable = 0;
|
||||
else
|
||||
objectInstance.classVariable = varargin{1};
|
||||
end
|
||||
end
|
||||
|
||||
%Set function
|
||||
function setValue(GenericClassInstance,newValue)
|
||||
GenericClassInstance.classVariable = newValue;
|
||||
|
||||
%MATLAB magic that changes the object in the scope that called
|
||||
%this set function.
|
||||
assignin('caller',inputname(1),GenericClassInstance);
|
||||
end
|
||||
|
||||
end %methods
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue