Note: Use only in the MuPAD Notebook Interface. This functionality does not run in MATLAB.
Although MuPAD® does not let you declare a method as private, you can create private methods by using closures.
MuPAD uses a fundamentally simple object and name lookup model. Objects are data that belong to a particular domain type, and domains have named entries (called slots). If the value of a slot is a function, this entry is called a method. Therefore, MuPAD lets you use the same techniques for hiding method calls as you use for hiding utility functions. For details, see Utility Functions in Closures.
This example creates the private method
d. This method is not accessible from
methods in inherited domains and from category methods:
domain d local f; inherits Dom::BaseDomain; g := proc() begin print("g"); f(); end; begin f := proc() begin print("f"); end; end: