MATLAB Documentation for OOP
(For reference by students)


 

ACCESSOR METHOD
Definition The method called whenever Matlab wants to access the contents of a class.
 
Example
This accesses the balance account of BankAccount.
 
function ans = getBalance(ba)
ans = ba.balance;

Without this accessor, you cannot access anything inside the BankAccount class even to get its balance.

Consider a class a private file which cannot be accessed without going through the proper channels, i.e an accessor

 


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

Website created & maintained by Shardul Bhatia and Wen Eu Cheah