Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Definition clarity
Posted:
Jun 25, 2013 10:48 AM


"MANIK " <mohitpant316@gmail.com> wrote in message news:kqa758$f4r$1@newscl01ah.mathworks.com... > what is the difference between instance methods and static methods
Instance methods need to be called on an instance of a class. For instance, if you had a car class the getColor method would need to be an instance method because each car can have a different color.
Static methods do not need a class instance to be called; they are associated with the class as a whole. For instance, the aforementioned car class could have a static method isCar that always returns true. We don't need to examine a particular car to determine if it is a car; by definition, cars are cars.
 Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com



