Content deleted Content added
TakuyaMurata (talk | contribs) clarify static method as shared method |
m Removed self-referential link to disambiguation page. |
||
Line 14:
In contrast to instance methods, a '''class method''' ('''shared method''') can be invoked without reference to a particular [[object (computer science)|object]]. These affect an entire [[Class (computer science)|class]], not merely a particular instance of the class. A typical example of a class method would be one that keeps count of the number of created objects within a given class. Some programming languages such as C++ and Java call them '''static method''' since methods are modified with <code>static</code>.
An '''abstract method''' is a
An '''accessor method''' is a kind of method that is usually small, simple and provides the means for the state of an object to be accessed from other parts of a program. Although it introduces a new dependency, use of the methods are preferred to directly accessing state data because they provide an abstraction layer. For example, if a bank-account class provides a "getBalance()" accessor method to retrieve the current balance (rather than directly accessing the balance data fields), then later revisions of the same code can implement a more complex mechanism balance retrieval (say, a database fetch) without the dependent code needing to be changed.
|