<s>
A	O
method	O
in	O
object-oriented	B-Language
programming	I-Language
(	O
OOP	O
)	O
is	O
a	O
procedure	O
associated	O
with	O
a	O
message	B-Architecture
and	O
an	O
object	O
.	O
</s>
<s>
Data	O
is	O
represented	O
as	O
properties	B-Language
of	O
the	O
object	O
,	O
and	O
behaviors	O
are	O
represented	O
as	O
methods	O
.	O
</s>
<s>
In	O
class-based	B-Application
programming	I-Application
,	O
methods	O
are	O
defined	O
within	O
a	O
class	O
,	O
and	O
objects	O
are	O
instances	O
of	O
a	O
given	O
class	O
.	O
</s>
<s>
One	O
of	O
the	O
most	O
important	O
capabilities	O
that	O
a	O
method	O
provides	O
is	O
method	B-Language
overriding	I-Language
-	O
the	O
same	O
name	O
(	O
e.g.	O
,	O
area	O
)	O
can	O
be	O
used	O
for	O
multiple	O
different	O
kinds	O
of	O
classes	O
.	O
</s>
<s>
A	O
method	O
in	O
Java	B-Language
programming	I-Language
sets	O
the	O
behavior	O
of	O
a	O
class	O
object	O
.	O
</s>
<s>
For	O
example	O
,	O
an	O
object	O
can	O
send	O
an	O
area	O
message	B-Architecture
to	O
another	O
object	O
and	O
the	O
appropriate	O
formula	O
is	O
invoked	O
whether	O
the	O
receiving	O
object	O
is	O
a	O
rectangle	O
,	O
circle	O
,	O
triangle	O
,	O
etc	O
.	O
</s>
<s>
Methods	O
also	O
provide	O
the	O
interface	O
that	O
other	O
classes	O
use	O
to	O
access	O
and	O
modify	O
the	O
properties	B-Language
of	O
an	O
object	O
;	O
this	O
is	O
known	O
as	O
encapsulation	B-Application
.	O
</s>
<s>
Encapsulation	B-Application
and	O
overriding	B-Language
are	O
the	O
two	O
primary	O
distinguishing	O
features	O
between	O
methods	O
and	O
procedure	O
calls	O
.	O
</s>
<s>
Method	B-Language
overriding	I-Language
and	O
overloading	B-Application
are	O
two	O
of	O
the	O
most	O
significant	O
ways	O
that	O
a	O
method	O
differs	O
from	O
a	O
conventional	O
procedure	O
or	O
function	O
call	O
.	O
</s>
<s>
Overriding	B-Language
refers	O
to	O
a	O
subclass	O
redefining	O
the	O
implementation	O
of	O
a	O
method	O
of	O
its	O
superclass	O
.	O
</s>
<s>
This	O
is	O
known	O
as	O
encapsulation	B-Application
and	O
is	O
meant	O
to	O
make	O
code	O
easier	O
to	O
maintain	O
and	O
re-use	O
.	O
</s>
<s>
Method	O
overloading	B-Application
,	O
on	O
the	O
other	O
hand	O
,	O
refers	O
to	O
differentiating	O
the	O
code	O
used	O
to	O
handle	O
a	O
message	B-Architecture
based	O
on	O
the	O
parameters	O
of	O
the	O
method	O
.	O
</s>
<s>
If	O
one	O
views	O
the	O
receiving	O
object	O
as	O
the	O
first	O
parameter	O
in	O
any	O
method	O
then	O
overriding	B-Language
is	O
just	O
a	O
special	O
case	O
of	O
overloading	B-Application
where	O
the	O
selection	O
is	O
based	O
only	O
on	O
the	O
first	O
argument	O
.	O
</s>
<s>
The	O
following	O
simple	O
Java	B-Language
example	O
illustrates	O
the	O
difference	O
:	O
</s>
<s>
constructors	O
and	O
destructors	B-Language
.	O
</s>
<s>
These	O
methods	O
provide	O
an	O
abstraction	B-Architecture
layer	I-Architecture
that	O
facilitates	O
encapsulation	B-Application
and	O
modularity	B-Architecture
.	O
</s>
<s>
For	O
example	O
,	O
if	O
a	O
bank-account	O
class	O
provides	O
a	O
getBalance( )	O
accessor	O
method	O
to	O
retrieve	O
the	O
current	O
balance	O
(	O
rather	O
than	O
directly	O
accessing	O
the	O
balance	O
data	O
fields	O
)	O
,	O
then	O
later	O
revisions	B-Architecture
of	O
the	O
same	O
code	O
can	O
implement	O
a	O
more	O
complex	O
mechanism	O
for	O
balance	O
retrieval	O
(	O
e.g.	O
,	O
a	O
database	O
fetch	O
)	O
,	O
without	O
the	O
dependent	O
code	O
needing	O
to	O
be	O
changed	O
.	O
</s>
<s>
The	O
concepts	O
of	O
encapsulation	B-Application
and	O
modularity	B-Architecture
are	O
not	O
unique	O
to	O
object-oriented	B-Language
programming	I-Language
.	O
</s>
<s>
Indeed	O
,	O
in	O
many	O
ways	O
the	O
object-oriented	B-Language
approach	O
is	O
simply	O
the	O
logical	O
extension	O
of	O
previous	O
paradigms	O
such	O
as	O
abstract	O
data	O
types	O
and	O
structured	B-Language
programming	I-Language
.	O
</s>
<s>
See	O
the	O
following	O
example	O
in	O
Java	B-Language
:	O
</s>
<s>
A	O
destructor	B-Language
is	O
a	O
method	O
that	O
is	O
called	O
automatically	O
at	O
the	O
end	O
of	O
an	O
object	O
's	O
lifetime	O
,	O
a	O
process	O
called	O
destruction	O
.	O
</s>
<s>
Destruction	O
in	O
most	O
languages	O
does	O
not	O
allow	O
destructor	B-Language
method	O
arguments	O
nor	O
return	O
values	O
.	O
</s>
<s>
In	O
garbage-collected	B-General_Concept
languages	O
,	O
such	O
as	O
Java	B-Language
,	O
C#	B-Application
,	O
and	O
Python	B-Language
,	O
destructors	B-Language
are	O
known	O
as	O
finalizers	B-Application
.	O
</s>
<s>
They	O
have	O
a	O
similar	O
purpose	O
and	O
function	O
to	O
destructors	B-Language
,	O
but	O
because	O
of	O
the	O
differences	O
between	O
languages	O
that	O
utilize	O
garbage-collection	O
and	O
languages	O
with	O
manual	O
memory	O
management	O
,	O
the	O
sequence	O
in	O
which	O
they	O
are	O
called	O
is	O
different	O
.	O
</s>
<s>
An	O
abstract	O
method	O
is	O
one	O
with	O
only	O
a	O
signature	O
and	O
no	O
implementation	B-Application
body	I-Application
.	O
</s>
<s>
Abstract	O
methods	O
are	O
used	O
to	O
specify	O
interfaces	B-Application
in	O
some	O
programming	O
languages	O
.	O
</s>
<s>
The	O
following	O
Java	B-Language
code	I-Language
shows	O
an	O
abstract	O
class	O
that	O
needs	O
to	O
be	O
extended	O
:	O
</s>
<s>
In	O
C#	B-Application
,	O
a	O
virtual	B-Application
method	I-Application
can	O
be	O
overridden	B-Language
with	O
an	O
abstract	O
method	O
.	O
</s>
<s>
(	O
This	O
also	O
applies	O
to	O
Java	B-Language
,	O
where	O
all	O
non-private	O
methods	O
are	O
virtual	O
.	O
)	O
</s>
<s>
Interfaces	B-Application
 '	O
default	O
methods	O
can	O
also	O
be	O
reabstracted	O
,	O
requiring	O
subclasses	O
to	O
implement	O
them	O
.	O
</s>
<s>
(	O
This	O
also	O
applies	O
to	O
Java	B-Language
.	O
)	O
</s>
<s>
Class	B-Application
methods	I-Application
are	O
methods	O
that	O
are	O
called	O
on	O
a	O
class	O
rather	O
than	O
an	O
instance	O
.	O
</s>
<s>
In	O
this	O
sense	O
,	O
they	O
provide	O
the	O
same	O
functionality	O
as	O
constructors	O
and	O
destructors	B-Language
described	O
above	O
.	O
</s>
<s>
But	O
in	O
some	O
languages	O
such	O
as	O
the	O
Common	B-Application
Lisp	I-Application
Object	I-Application
System	I-Application
(	O
CLOS	B-Application
)	O
the	O
meta-model	O
allows	O
the	O
developer	O
to	O
dynamically	O
alter	O
the	O
object	B-Application
model	I-Application
at	O
run	O
time	O
:	O
e.g.	O
,	O
to	O
create	O
new	O
classes	O
,	O
redefine	O
the	O
class	O
hierarchy	O
,	O
modify	O
properties	B-Language
,	O
etc	O
.	O
</s>
<s>
They	O
are	O
similar	O
to	O
static	B-General_Concept
variables	I-General_Concept
in	O
that	O
sense	O
.	O
</s>
<s>
In	O
Java	B-Language
,	O
a	O
commonly	O
used	O
static	O
method	O
is	O
:	O
</s>
<s>
Static	O
methods	O
are	O
called	O
"	O
static	O
"	O
because	O
they	O
are	O
resolved	O
at	O
compile	B-Application
time	I-Application
based	O
on	O
the	O
class	O
they	O
are	O
called	O
on	O
and	O
not	O
dynamically	O
as	O
in	O
the	O
case	O
with	O
instance	O
methods	O
,	O
which	O
are	O
resolved	O
polymorphically	O
based	O
on	O
the	O
runtime	O
type	O
of	O
the	O
object	O
.	O
</s>
<s>
C++	B-Language
example	O
:	O
</s>
<s>
Some	O
procedural	O
languages	O
were	O
extended	O
with	O
object-oriented	B-Language
capabilities	O
to	O
leverage	O
the	O
large	O
skill	O
sets	O
and	O
legacy	O
code	O
for	O
those	O
languages	O
but	O
still	O
provide	O
the	O
benefits	O
of	O
object-oriented	B-Language
development	O
.	O
</s>
<s>
Perhaps	O
the	O
most	O
well-known	O
example	O
is	O
C++	B-Language
,	O
an	O
object-oriented	B-Language
extension	O
of	O
the	O
C	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
Due	O
to	O
the	O
design	O
requirements	O
to	O
add	O
the	O
object-oriented	B-Language
paradigm	O
on	O
to	O
an	O
existing	O
procedural	O
language	O
,	O
message	B-Architecture
passing	I-Architecture
in	O
C++	B-Language
has	O
some	O
unique	O
capabilities	O
and	O
terminologies	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
C++	B-Language
a	O
method	O
is	O
known	O
as	O
a	O
member	O
function	O
.	O
</s>
<s>
C++	B-Language
also	O
has	O
the	O
concept	O
of	O
virtual	B-Application
functions	I-Application
which	O
are	O
member	O
functions	O
that	O
can	O
be	O
overridden	B-Language
in	O
derived	O
classes	O
and	O
allow	O
for	O
dynamic	O
dispatch	O
.	O
</s>
<s>
Virtual	B-Application
functions	I-Application
are	O
the	O
means	O
by	O
which	O
a	O
C++	B-Language
class	O
can	O
achieve	O
polymorphic	B-Application
behavior	O
.	O
</s>
<s>
Non-virtual	O
member	O
functions	O
,	O
or	O
regular	O
methods	O
,	O
are	O
those	O
that	O
do	O
not	O
participate	O
in	O
polymorphism	B-Application
.	O
</s>
<s>
C++	B-Language
Example	O
:	O
</s>
