Content deleted Content added
m removing title bolding |
|||
Line 7:
Methods also provide the interface that other classes use to access and modify the data [[Property (programming)|properties]] of an object. This is known as encapsulation. Encapsulation and overriding are the two primary distinguishing features between methods and procedure calls.<ref>{{cite web|title=What is an Object?|url=http://docs.oracle.com/javase/tutorial/java/concepts/object.html|work=oracle.com|publisher=Oracle Corporation|accessdate=13 December 2013}}</ref>
==
[[Method overriding]] and [[overloading]] are two of the most significant ways that a method differs from a conventional procedure or function call. Overriding refers to a subclass redefining the implementation of a method of its superclass. For example, <code>findArea</code> may be a method defined on a shape class. The various subclasses: <code>rectangle</code>, <code>circle</code>, <code>triangle</code>, etc. would each define the appropriate formula to calculate their area. The idea is to look at objects as "black boxes" so that changes to the internals of the object can be made with minimal impact on the other objects that use it. This is known as encapsulation and is meant to make code easier to maintain and re-use.
Line 39:
</syntaxhighlight>
==
Accessor methods are used to read data values of an object. Mutator methods are used to modify the data of an object. Manager methods are used to initialize and destroy objects of a class, e.g. constructors and destructors.
|