MATLAB Documentation for OOP
(For reference by students)


 

ISA
Definition A function which returns true if object is a given class.
ISA(OBJ,'class_name') returns true if OBJ is of the class, or inherits
from the class, 'class_name' and false otherwise.
 
Example
function acct = BankAccount(data)
if nargin == 0
   acct.balance = 0;
   acct = class(acct,'BankAccount');
elseif isa(data, 'BankAccount')
   acct = data;
else
   acct.balance = data;
   acct = class(acct,'BankAccount');
end
 
In this case if data was a class, ISA would return a true and the object acct would just be a copy of data.
 


Got comments\feedback\suggestions\complaints\anything whatsoever? Shoot the webmaster an email!

Website created & maintained by Shardul Bhatia and Wen Eu Cheah