MATLAB Object-Oriented Programming

(Joyce) #1

end
end
end


Calling Static Methods


Invoke static methods using the name of the class followed by dot (.), then the name of
the method:


classname.staticMethodName(args,...)


Calling the pi method of MyClass in the previous section would require this statement:


value = MyClass.pi(.001);


You can also invoke static methods using an instance of the class, like any method:


obj = MyClass;
value = obj.pi(.001);


Inheriting Static Methods


Subclasses can redefine static methods unless the method's Sealed attribute is also set
to true in the superclass.


See Also


Related Examples



  • “Implementing the AccountManager Class” on page 3-15


See Also
Free download pdf