<s>
In	O
object-oriented	B-Language
programming	I-Language
,	O
a	O
class	O
is	O
an	O
extensible	O
program-code-template	O
for	O
creating	O
objects	O
,	O
providing	O
initial	O
values	O
for	O
state	O
(	O
member	B-Application
variables	I-Application
)	O
and	O
implementations	O
of	O
behavior	O
(	O
member	O
functions	O
or	O
methods	B-Language
)	O
.	O
</s>
<s>
When	O
an	O
object	O
is	O
created	O
by	O
a	O
constructor	O
of	O
the	O
class	O
,	O
the	O
resulting	O
object	O
is	O
called	O
an	O
instance	O
of	O
the	O
class	O
,	O
and	O
the	O
member	B-Application
variables	I-Application
specific	O
to	O
the	O
object	O
are	O
called	O
instance	B-Application
variables	I-Application
,	O
to	O
contrast	O
with	O
the	O
class	B-Application
variables	I-Application
shared	O
across	O
the	O
class	O
.	O
</s>
<s>
In	O
certain	O
languages	O
,	O
classes	O
are	O
,	O
as	O
a	O
matter	O
of	O
fact	O
,	O
only	O
a	O
compile-time	B-Application
feature	O
(	O
new	O
classes	O
cannot	O
be	O
declared	O
at	O
run-time	B-Library
)	O
,	O
while	O
in	O
other	O
languages	O
classes	O
are	O
first-class	O
citizens	O
,	O
and	O
are	O
generally	O
themselves	O
objects	O
(	O
typically	O
of	O
type	O
or	O
similar	O
)	O
.	O
</s>
<s>
In	O
these	O
languages	O
,	O
a	O
class	O
that	O
creates	O
classes	O
within	O
itself	O
is	O
called	O
a	O
metaclass	B-Language
.	O
</s>
<s>
In	O
its	O
most	O
casual	O
usage	O
,	O
people	O
often	O
refer	O
to	O
the	O
"	O
class	O
"	O
of	O
an	O
object	O
,	O
but	O
narrowly	O
speaking	O
objects	O
have	O
type	O
:	O
the	O
interface	B-Language
,	O
namely	O
the	O
types	O
of	O
member	B-Application
variables	I-Application
,	O
the	O
signatures	O
of	O
member	O
functions	O
(	O
methods	B-Language
)	O
,	O
and	O
properties	B-Language
these	O
satisfy	O
.	O
</s>
<s>
At	O
the	O
same	O
time	O
,	O
a	O
class	O
has	O
an	O
implementation	O
(	O
specifically	O
the	O
implementation	O
of	O
the	O
methods	B-Language
)	O
,	O
and	O
can	O
create	O
objects	O
of	O
a	O
given	O
type	O
,	O
with	O
a	O
given	O
implementation	O
.	O
</s>
<s>
In	O
the	O
terms	O
of	O
type	O
theory	O
,	O
a	O
class	O
is	O
an	O
implementationa	O
concrete	O
data	B-General_Concept
structure	I-General_Concept
and	O
collection	O
of	O
subroutineswhile	O
a	O
type	O
is	O
an	O
interface	B-Language
.	O
</s>
<s>
For	O
example	O
,	O
a	O
type	O
might	O
represent	O
the	O
properties	B-Language
and	O
functionality	O
of	O
bananas	B-Operating_System
in	O
general	O
,	O
while	O
the	O
and	O
classes	O
would	O
represent	O
ways	O
of	O
producing	O
bananas	B-Operating_System
(	O
say	O
,	O
banana	B-Operating_System
suppliers	O
or	O
data	B-General_Concept
structures	I-General_Concept
and	O
functions	O
to	O
represent	O
and	O
draw	O
bananas	B-Operating_System
in	O
a	O
video	O
game	O
)	O
.	O
</s>
<s>
The	O
class	O
could	O
then	O
produce	O
particular	O
bananas	B-Operating_System
:	O
instances	O
of	O
the	O
class	O
would	O
be	O
objects	O
of	O
type	O
.	O
</s>
<s>
A	O
class	O
contains	O
data	B-Application
field	I-Application
descriptions	O
(	O
or	O
properties	B-Language
,	O
fields	B-Application
,	O
data	B-Application
members	I-Application
,	O
or	O
attributes	B-General_Concept
)	O
.	O
</s>
<s>
These	O
are	O
usually	O
field	O
types	O
and	O
names	O
that	O
will	O
be	O
associated	B-Application
with	O
state	O
variables	O
at	O
program	O
run	B-Library
time	I-Library
;	O
these	O
state	O
variables	O
either	O
belong	O
to	O
the	O
class	O
or	O
specific	O
instances	O
of	O
the	O
class	O
.	O
</s>
<s>
Other	O
implementations	O
are	O
possible	O
:	O
for	O
example	O
,	O
objects	O
in	O
Python	B-Language
use	O
associative	O
key-value	O
containers	O
.	O
</s>
<s>
Encapsulation	B-Application
of	O
state	O
is	O
necessary	O
for	O
being	O
able	O
to	O
enforce	O
the	O
invariants	O
of	O
the	O
class	O
.	O
</s>
<s>
The	O
behavior	O
of	O
class	O
or	O
its	O
instances	O
is	O
defined	O
using	O
methods	B-Language
.	O
</s>
<s>
Methods	B-Language
are	O
subroutines	O
with	O
the	O
ability	O
to	O
operate	O
on	O
objects	O
or	O
classes	O
.	O
</s>
<s>
Many	O
kinds	O
of	O
methods	B-Language
exist	O
,	O
but	O
support	O
for	O
them	O
varies	O
across	O
languages	O
.	O
</s>
<s>
Some	O
types	O
of	O
methods	B-Language
are	O
created	O
and	O
called	O
by	O
programmer	O
code	O
,	O
while	O
other	O
special	O
methods	B-Language
—	O
such	O
as	O
constructors	O
,	O
destructors	O
,	O
and	O
conversion	O
operators	O
—	O
are	O
created	O
and	O
called	O
by	O
compiler-generated	O
code	O
.	O
</s>
<s>
A	O
language	O
may	O
also	O
allow	O
the	O
programmer	O
to	O
define	O
and	O
call	O
these	O
special	O
methods	B-Language
.	O
</s>
<s>
Every	O
class	O
implements	B-Language
(	O
or	O
realizes	O
)	O
an	O
interface	B-Language
by	O
providing	O
structure	O
and	O
behavior	O
.	O
</s>
<s>
Structure	O
consists	O
of	O
data	B-General_Concept
and	O
state	O
,	O
and	O
behavior	O
consists	O
of	O
code	O
that	O
specifies	O
how	O
methods	B-Language
are	O
implemented	O
.	O
</s>
<s>
There	O
is	O
a	O
distinction	O
between	O
the	O
definition	O
of	O
an	O
interface	B-Language
and	O
the	O
implementation	O
of	O
that	O
interface	B-Language
;	O
however	O
,	O
this	O
line	O
is	O
blurred	O
in	O
many	O
programming	O
languages	O
because	O
class	O
declarations	O
both	O
define	O
and	O
implement	O
an	O
interface	B-Language
.	O
</s>
<s>
Some	O
languages	O
,	O
however	O
,	O
provide	O
features	O
that	O
separate	O
interface	B-Language
and	O
implementation	O
.	O
</s>
<s>
For	O
example	O
,	O
an	O
abstract	O
class	O
can	O
define	O
an	O
interface	B-Language
without	O
providing	O
implementation	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
"	O
class	O
A	O
"	O
inherits	O
from	O
"	O
class	O
B	O
"	O
and	O
if	O
"	O
class	O
B	O
"	O
implements	B-Language
the	O
interface	B-Language
"	O
interface	B-Language
B	O
"	O
then	O
"	O
class	O
A	O
"	O
also	O
inherits	O
the	O
functionality(constants and methods declaration )	O
provided	O
by	O
"	O
interface	B-Language
B	O
"	O
.	O
</s>
<s>
In	O
languages	O
that	O
support	O
access	O
specifiers	O
,	O
the	O
interface	B-Language
of	O
a	O
class	O
is	O
considered	O
to	O
be	O
the	O
set	O
of	O
public	O
members	B-Application
of	O
the	O
class	O
,	O
including	O
both	O
methods	B-Language
and	O
attributes	B-General_Concept
(	O
via	O
implicit	O
getter	O
and	O
setter	O
methods	B-Language
)	O
;	O
any	O
private	O
members	B-Application
or	O
internal	O
data	B-General_Concept
structures	I-General_Concept
are	O
not	O
intended	O
to	O
be	O
depended	O
on	O
by	O
external	O
code	O
and	O
thus	O
are	O
not	O
part	O
of	O
the	O
interface	B-Language
.	O
</s>
<s>
Object-oriented	B-Language
programming	I-Language
methodology	O
dictates	O
that	O
the	O
operations	O
of	O
any	O
interface	B-Language
of	O
a	O
class	O
are	O
to	O
be	O
independent	O
of	O
each	O
other	O
.	O
</s>
<s>
It	O
results	O
in	O
a	O
layered	O
design	O
where	O
clients	O
of	O
an	O
interface	B-Language
use	O
the	O
methods	B-Language
declared	O
in	O
the	O
interface	B-Language
.	O
</s>
<s>
An	O
interface	B-Language
places	O
no	O
requirements	O
for	O
clients	O
to	O
invoke	O
the	O
operations	O
of	O
one	O
interface	B-Language
in	O
any	O
particular	O
order	O
.	O
</s>
<s>
This	O
approach	O
has	O
the	O
benefit	O
that	O
client	O
code	O
can	O
assume	O
that	O
the	O
operations	O
of	O
an	O
interface	B-Language
are	O
available	O
for	O
use	O
whenever	O
the	O
client	O
has	O
access	O
to	O
the	O
object	O
.	O
</s>
<s>
The	O
buttons	O
on	O
the	O
front	O
of	O
your	O
television	O
set	O
are	O
the	O
interface	B-Language
between	O
you	O
and	O
the	O
electrical	O
wiring	O
on	O
the	O
other	O
side	O
of	O
its	O
plastic	O
casing	O
.	O
</s>
<s>
In	O
this	O
example	O
,	O
your	O
particular	O
television	O
is	O
the	O
instance	O
,	O
each	O
method	O
is	O
represented	O
by	O
a	O
button	O
,	O
and	O
all	O
the	O
buttons	O
together	O
compose	O
the	O
interface	B-Language
(	O
other	O
television	O
sets	O
that	O
are	O
the	O
same	O
model	O
as	O
yours	O
would	O
have	O
the	O
same	O
interface	B-Language
)	O
.	O
</s>
<s>
In	O
its	O
most	O
common	O
form	O
,	O
an	O
interface	B-Language
is	O
a	O
specification	O
of	O
a	O
group	O
of	O
related	O
methods	B-Language
without	O
any	O
associated	B-Application
implementation	O
of	O
the	O
methods	B-Language
.	O
</s>
<s>
A	O
television	O
set	O
also	O
has	O
a	O
myriad	O
of	O
attributes	B-General_Concept
,	O
such	O
as	O
size	O
and	O
whether	O
it	O
supports	O
colour	O
,	O
which	O
together	O
comprise	O
its	O
structure	O
.	O
</s>
<s>
A	O
class	O
represents	O
the	O
full	O
description	O
of	O
a	O
television	O
,	O
including	O
its	O
attributes	B-General_Concept
(	O
structure	O
)	O
and	O
buttons	O
(	O
interface	B-Language
)	O
.	O
</s>
<s>
This	O
method	O
is	O
clearly	O
associated	B-Application
with	O
the	O
class	O
,	O
yet	O
is	O
outside	O
the	O
domain	O
of	O
each	O
individual	O
instance	O
of	O
the	O
class	O
.	O
</s>
<s>
Only	O
methods	B-Language
that	O
are	O
part	O
of	O
the	O
same	O
class	O
can	O
access	O
private	O
members	B-Application
.	O
</s>
<s>
Although	O
many	O
object-oriented	B-Language
languages	I-Language
support	O
the	O
above	O
access	O
specifiers	O
,	O
their	O
semantics	O
may	O
differ	O
.	O
</s>
<s>
Object-oriented	B-Language
design	O
uses	O
the	O
access	O
specifiers	O
in	O
conjunction	O
with	O
careful	O
design	O
of	O
public	O
method	O
implementations	O
to	O
enforce	O
class	B-Application
invariants	I-Application
—	O
constraints	O
on	O
the	O
state	O
of	O
the	O
objects	O
.	O
</s>
<s>
A	O
common	O
usage	O
of	O
access	O
specifiers	O
is	O
to	O
separate	O
the	O
internal	O
data	B-General_Concept
of	O
a	O
class	O
from	O
its	O
interface	B-Language
:	O
the	O
internal	O
structure	O
is	O
made	O
private	O
,	O
while	O
public	O
accessor	O
methods	B-Language
can	O
be	O
used	O
to	O
inspect	O
or	O
alter	O
such	O
private	O
data	B-General_Concept
.	O
</s>
<s>
Access	O
specifiers	O
do	O
not	O
necessarily	O
control	O
visibility	O
,	O
in	O
that	O
even	O
private	O
members	B-Application
may	O
be	O
visible	O
to	O
client	O
external	O
code	O
.	O
</s>
<s>
In	O
some	O
languages	O
,	O
an	O
inaccessible	O
but	O
visible	O
member	O
may	O
be	O
referred	O
to	O
at	O
run-time	B-Library
(	O
for	O
example	O
,	O
by	O
a	O
pointer	O
returned	O
from	O
a	O
member	O
function	O
)	O
,	O
but	O
an	O
attempt	O
to	O
use	O
it	O
by	O
referring	O
to	O
the	O
name	O
of	O
the	O
member	O
from	O
client	O
code	O
will	O
be	O
prevented	O
by	O
the	O
type	O
checker	O
.	O
</s>
<s>
The	O
various	O
object-oriented	B-Language
programming	I-Language
languages	I-Language
enforce	O
member	O
accessibility	O
and	O
visibility	O
to	O
various	O
degrees	O
,	O
and	O
depending	O
on	O
the	O
language	O
's	O
type	O
system	O
and	O
compilation	O
policies	O
,	O
enforced	O
at	O
either	O
compile-time	B-Application
or	O
run-time	B-Library
.	O
</s>
<s>
For	O
example	O
,	O
the	O
Java	B-Language
language	I-Language
does	O
not	O
allow	O
client	O
code	O
that	O
accesses	O
the	O
private	O
data	B-General_Concept
of	O
a	O
class	O
to	O
compile	O
.	O
</s>
<s>
In	O
the	O
C++	B-Language
language	I-Language
,	O
private	O
methods	B-Language
are	O
visible	O
,	O
but	O
not	O
accessible	O
in	O
the	O
interface	B-Language
;	O
however	O
,	O
they	O
may	O
be	O
made	O
invisible	O
by	O
explicitly	O
declaring	O
fully	O
abstract	O
classes	O
that	O
represent	O
the	O
interfaces	O
of	O
the	O
class	O
.	O
</s>
<s>
Instance	O
vs.	O
class	O
accessibility	O
:	O
Ruby	B-Language
supports	O
instance-private	O
and	O
instance-protected	O
access	O
specifiers	O
in	O
lieu	O
of	O
class-private	O
and	O
class-protected	O
,	O
respectively	O
.	O
</s>
<s>
Friend	O
:	O
C++	B-Language
supports	O
a	O
mechanism	O
where	O
a	O
function	O
explicitly	O
declared	O
as	O
a	O
friend	B-Language
function	I-Language
of	O
the	O
class	O
may	O
access	O
the	O
members	B-Application
designated	O
as	O
private	O
or	O
protected	O
.	O
</s>
<s>
Path-based	O
:	O
Java	B-Language
supports	O
restricting	O
access	O
to	O
a	O
member	O
within	O
a	O
Java	B-Language
package	O
,	O
which	O
is	O
the	O
logical	O
path	O
of	O
the	O
file	O
.	O
</s>
<s>
However	O
,	O
it	O
is	O
a	O
common	O
practice	O
when	O
extending	O
a	O
Java	B-Language
framework	B-Architecture
to	O
implement	O
classes	O
in	O
the	O
same	O
package	O
as	O
a	O
framework	B-Architecture
class	O
in	O
order	O
to	O
access	O
protected	O
members	B-Application
.	O
</s>
<s>
Compositional	O
relationship	O
between	O
classes	O
is	O
also	O
commonly	O
known	O
as	O
a	O
has-a	B-Application
relationship	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Objective-C	B-Language
2.0	O
:	O
</s>
<s>
Structural	O
and	O
behavioral	O
members	B-Application
of	O
the	O
parent	O
classes	O
are	O
inherited	O
by	O
the	O
child	O
class	O
.	O
</s>
<s>
Derived	O
classes	O
can	O
define	O
additional	O
structural	O
members	B-Application
(	O
data	B-Application
fields	I-Application
)	O
and	O
behavioral	O
members	B-Application
(	O
methods	B-Language
)	O
in	O
addition	O
to	O
those	O
that	O
they	O
inherit	O
and	O
are	O
therefore	O
specializations	O
of	O
their	O
superclasses	O
.	O
</s>
<s>
Also	O
,	O
derived	O
classes	O
can	O
override	B-Language
inherited	O
methods	B-Language
if	O
the	O
language	O
allows	O
.	O
</s>
<s>
Not	O
all	O
languages	O
support	O
multiple	B-Application
inheritance	I-Application
.	O
</s>
<s>
For	O
example	O
,	O
Java	B-Language
allows	O
a	O
class	O
to	O
implement	O
multiple	O
interfaces	O
,	O
but	O
only	O
inherit	O
from	O
one	O
class	O
.	O
</s>
<s>
If	O
multiple	B-Application
inheritance	I-Application
is	O
allowed	O
,	O
the	O
hierarchy	O
is	O
a	O
directed	O
acyclic	O
graph	O
(	O
or	O
DAG	O
for	O
short	O
)	O
,	O
otherwise	O
it	O
is	O
a	O
tree	O
.	O
</s>
<s>
Classes	O
in	O
the	O
same	O
level	O
are	O
more	O
likely	O
to	O
be	O
associated	B-Application
than	O
classes	O
in	O
different	O
levels	O
.	O
</s>
<s>
The	O
levels	O
of	O
this	O
hierarchy	O
are	O
called	O
layers	B-Application
or	O
levels	O
of	O
abstraction	O
.	O
</s>
<s>
Example	O
(	O
Simplified	O
Objective-C	B-Language
2.0	O
code	O
,	O
from	O
iPhone	O
SDK	O
)	O
:	O
</s>
<s>
In	O
object-oriented	B-Application
modeling	I-Application
these	O
kinds	O
of	O
relations	O
are	O
typically	O
modeled	O
as	O
object	O
properties	B-Language
.	O
</s>
<s>
Object	O
modeling	O
languages	O
such	O
as	O
UML	B-Language
include	O
capabilities	O
to	O
model	O
various	O
aspects	O
of	O
"	O
part	O
of	O
"	O
and	O
other	O
kinds	O
of	O
relations	O
–	O
data	B-General_Concept
such	O
as	O
the	O
cardinality	O
of	O
the	O
objects	O
,	O
constraints	O
on	O
input	O
and	O
output	O
values	O
,	O
etc	O
.	O
</s>
<s>
This	O
information	O
can	O
be	O
utilized	O
by	O
developer	O
tools	O
to	O
generate	O
additional	O
code	O
beside	O
the	O
basic	O
data	B-General_Concept
definitions	O
for	O
the	O
objects	O
,	O
such	O
as	O
error	O
checking	O
on	O
get	O
and	O
set	O
methods	B-Language
.	O
</s>
<s>
However	O
,	O
while	O
some	O
systems	O
such	O
as	O
Flavors	O
and	O
CLOS	B-Application
provide	O
a	O
capability	O
for	O
more	O
than	O
one	O
parent	O
to	O
do	O
so	O
at	O
run	B-Library
time	I-Library
introduces	O
complexity	O
that	O
many	O
in	O
the	O
object-oriented	B-Language
community	O
consider	O
antithetical	O
to	O
the	O
goals	O
of	O
using	O
object	O
classes	O
in	O
the	O
first	O
place	O
.	O
</s>
<s>
Most	O
modern	O
object-oriented	B-Language
languages	I-Language
such	O
as	O
Smalltalk	B-Application
and	O
Java	B-Language
require	O
single	O
inheritance	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
For	O
these	O
languages	O
,	O
multiple	B-Application
inheritance	I-Application
may	O
be	O
useful	O
for	O
modeling	O
but	O
not	O
for	O
an	O
implementation	O
.	O
</s>
<s>
The	O
volatility	O
of	O
the	O
Internet	O
requires	O
this	O
level	O
of	O
flexibility	O
and	O
the	O
technology	O
standards	O
such	O
as	O
the	O
Web	B-Language
Ontology	I-Language
Language	I-Language
(	O
OWL	B-Language
)	O
are	O
designed	O
to	O
support	O
it	O
.	O
</s>
<s>
A	O
similar	O
issue	O
is	O
whether	O
or	O
not	O
the	O
class	O
hierarchy	O
can	O
be	O
modified	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
Languages	O
such	O
as	O
Flavors	O
,	O
CLOS	B-Application
,	O
and	O
Smalltalk	B-Application
all	O
support	O
this	O
feature	O
as	O
part	O
of	O
their	O
meta-object	O
protocols	O
.	O
</s>
<s>
Other	O
languages	O
that	O
focus	O
more	O
on	O
strong	O
typing	O
such	O
as	O
Java	B-Language
and	O
C++	B-Language
do	O
not	O
allow	O
the	O
class	O
hierarchy	O
to	O
be	O
modified	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
Semantic	O
web	O
objects	O
have	O
the	O
capability	O
for	O
run	B-Library
time	I-Library
changes	O
to	O
classes	O
.	O
</s>
<s>
Although	O
class-based	B-Application
languages	I-Application
are	O
commonly	O
assumed	O
to	O
support	O
inheritance	O
,	O
inheritance	O
is	O
not	O
an	O
intrinsic	O
aspect	O
of	O
the	O
concept	O
of	O
classes	O
.	O
</s>
<s>
Some	O
languages	O
,	O
often	O
referred	O
to	O
as	O
"	O
object-based	B-Application
languages	I-Application
"	O
,	O
support	O
classes	O
yet	O
do	O
not	O
support	O
inheritance	O
.	O
</s>
<s>
Examples	O
of	O
object-based	B-Application
languages	I-Application
include	O
earlier	O
versions	O
of	O
Visual	B-Language
Basic	I-Language
.	O
</s>
<s>
In	O
object-oriented	B-Application
analysis	I-Application
and	O
in	O
UML	B-Language
,	O
an	O
association	O
between	O
two	O
classes	O
represents	O
a	O
collaboration	O
between	O
the	O
classes	O
or	O
their	O
corresponding	O
instances	O
.	O
</s>
<s>
In	O
a	O
language	O
that	O
supports	O
inheritance	O
,	O
an	O
abstract	O
class	O
,	O
or	O
abstract	B-Application
base	I-Application
class	I-Application
(	O
ABC	O
)	O
,	O
is	O
a	O
class	O
that	O
cannot	O
be	O
instantiated	O
because	O
it	O
is	O
either	O
labeled	O
as	O
abstract	O
or	O
it	O
simply	O
specifies	O
abstract	O
methods	B-Language
(	O
or	O
virtual	B-Application
methods	I-Application
)	O
.	O
</s>
<s>
An	O
abstract	O
class	O
may	O
provide	O
implementations	O
of	O
some	O
methods	B-Language
,	O
and	O
may	O
also	O
specify	O
virtual	B-Application
methods	I-Application
via	O
signatures	O
that	O
are	O
to	O
be	O
implemented	O
by	O
direct	O
or	O
indirect	O
descendants	O
of	O
the	O
abstract	O
class	O
.	O
</s>
<s>
Before	O
a	O
class	O
derived	O
from	O
an	O
abstract	O
class	O
can	O
be	O
instantiated	O
,	O
all	O
abstract	O
methods	B-Language
of	O
its	O
parent	O
classes	O
must	O
be	O
implemented	O
by	O
some	O
class	O
in	O
the	O
derivation	O
chain	O
.	O
</s>
<s>
Most	O
object-oriented	B-Language
programming	I-Language
languages	I-Language
allow	O
the	O
programmer	O
to	O
specify	O
which	O
classes	O
are	O
considered	O
abstract	O
and	O
will	O
not	O
allow	O
these	O
to	O
be	O
instantiated	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Java	B-Language
,	O
C#	B-Application
and	O
PHP	B-Application
,	O
the	O
keyword	O
abstract	O
is	O
used	O
.	O
</s>
<s>
In	O
C++	B-Language
,	O
an	O
abstract	O
class	O
is	O
a	O
class	O
having	O
at	O
least	O
one	O
abstract	O
method	O
given	O
by	O
the	O
appropriate	O
syntax	O
in	O
that	O
language	O
(	O
a	O
pure	B-Application
virtual	I-Application
function	I-Application
in	O
C++	B-Language
parlance	O
)	O
.	O
</s>
<s>
A	O
class	O
consisting	O
of	O
only	O
virtual	B-Application
methods	I-Application
is	O
called	O
a	O
Pure	O
Abstract	B-Application
Base	I-Application
Class	I-Application
(	O
or	O
Pure	O
ABC	O
)	O
in	O
C++	B-Language
and	O
is	O
also	O
known	O
as	O
an	O
interface	B-Language
by	O
users	O
of	O
the	O
language	O
.	O
</s>
<s>
Other	O
languages	O
,	O
notably	O
Java	B-Language
and	O
C#	B-Application
,	O
support	O
a	O
variant	O
of	O
abstract	O
classes	O
called	O
an	O
interface	B-Language
via	O
a	O
keyword	O
in	O
the	O
language	O
.	O
</s>
<s>
In	O
these	O
languages	O
,	O
multiple	B-Application
inheritance	I-Application
is	O
not	O
allowed	O
,	O
but	O
a	O
class	O
can	O
implement	O
multiple	O
interfaces	O
.	O
</s>
<s>
Such	O
a	O
class	O
can	O
only	O
contain	O
abstract	O
publicly	O
accessible	O
methods	B-Language
.	O
</s>
<s>
In	O
some	O
languages	O
,	O
classes	O
can	O
be	O
declared	O
in	O
scopes	B-Language
other	O
than	O
the	O
global	O
scope	O
.	O
</s>
<s>
An	O
inner	B-Language
class	I-Language
is	O
a	O
class	O
defined	O
within	O
another	O
class	O
.	O
</s>
<s>
The	O
relationship	O
between	O
an	O
inner	B-Language
class	I-Language
and	O
its	O
containing	O
class	O
can	O
also	O
be	O
treated	O
as	O
another	O
type	O
of	O
class	O
association	O
.	O
</s>
<s>
An	O
inner	B-Language
class	I-Language
is	O
typically	O
neither	O
associated	B-Application
with	O
instances	O
of	O
the	O
enclosing	O
class	O
nor	O
instantiated	O
along	O
with	O
its	O
enclosing	O
class	O
.	O
</s>
<s>
A	O
related	O
concept	O
is	O
inner	O
types	O
,	O
also	O
known	O
as	O
inner	O
data	B-General_Concept
type	O
or	O
nested	O
type	O
,	O
which	O
is	O
a	O
generalization	O
of	O
the	O
concept	O
of	O
inner	O
classes	O
.	O
</s>
<s>
C++	B-Language
is	O
an	O
example	O
of	O
a	O
language	O
that	O
supports	O
both	O
inner	O
classes	O
and	O
inner	O
types	O
(	O
via	O
typedef	B-Language
declarations	O
)	O
.	O
</s>
<s>
Another	O
type	O
is	O
a	O
local	B-Language
class	I-Language
,	O
which	O
is	O
a	O
class	O
defined	O
within	O
a	O
procedure	O
or	O
function	O
.	O
</s>
<s>
One	O
common	O
restriction	O
is	O
to	O
disallow	O
local	B-Language
class	I-Language
methods	B-Language
to	O
access	O
local	O
variables	O
of	O
the	O
enclosing	O
function	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
C++	B-Language
,	O
a	O
local	B-Language
class	I-Language
may	O
refer	O
to	O
static	B-General_Concept
variables	I-General_Concept
declared	O
within	O
its	O
enclosing	O
function	O
,	O
but	O
may	O
not	O
access	O
the	O
function	O
's	O
automatic	B-General_Concept
variables	I-General_Concept
.	O
</s>
<s>
Metaclasses	B-Language
are	O
classes	O
whose	O
instances	O
are	O
classes	O
.	O
</s>
<s>
A	O
metaclass	B-Language
describes	O
a	O
common	O
structure	O
of	O
a	O
collection	O
of	O
classes	O
and	O
can	O
implement	O
a	O
design	O
pattern	O
or	O
describe	O
particular	O
kinds	O
of	O
classes	O
.	O
</s>
<s>
Metaclasses	B-Language
are	O
often	O
used	O
to	O
describe	O
frameworks	O
.	O
</s>
<s>
In	O
some	O
languages	O
,	O
such	O
as	O
Python	B-Language
,	O
Ruby	B-Language
or	O
Smalltalk	B-Application
,	O
a	O
class	O
is	O
also	O
an	O
object	O
;	O
thus	O
each	O
class	O
is	O
an	O
instance	O
of	O
a	O
unique	O
metaclass	B-Language
that	O
is	O
built	O
into	O
the	O
language	O
.	O
</s>
<s>
The	O
Common	B-Application
Lisp	I-Application
Object	I-Application
System	I-Application
(	O
CLOS	B-Application
)	O
provides	O
metaobject	O
protocols	O
(	O
MOPs	O
)	O
to	O
implement	O
those	O
classes	O
and	O
metaclasses	B-Language
.	O
</s>
<s>
A	O
non-subclassable	O
class	O
is	O
created	O
by	O
declaring	O
the	O
class	O
as	O
in	O
C#	B-Application
or	O
as	O
in	O
Java	B-Language
or	O
PHP	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
Java	B-Language
's	O
class	O
is	O
designated	O
as	O
final	O
.	O
</s>
<s>
Typically	O
,	O
an	O
executable	B-Application
program	I-Application
cannot	O
be	O
changed	O
by	O
customers	O
.	O
</s>
<s>
In	O
Ruby	B-Language
,	O
all	O
classes	O
are	O
open	O
.	O
</s>
<s>
In	O
Python	B-Language
,	O
classes	O
can	O
be	O
created	O
at	B-Library
runtime	I-Library
,	O
and	O
all	O
can	O
be	O
modified	O
afterwards	O
.	O
</s>
<s>
Objective-C	B-Language
categories	O
permit	O
the	O
programmer	O
to	O
add	O
methods	B-Language
to	O
an	O
existing	O
class	O
without	O
the	O
need	O
to	O
recompile	O
that	O
class	O
or	O
even	O
have	O
access	O
to	O
its	O
source	O
code	O
.	O
</s>
<s>
Some	O
languages	O
have	O
special	O
support	O
for	O
mixins	B-Language
,	O
though	O
in	O
any	O
language	O
with	O
multiple	B-Application
inheritance	I-Application
a	O
mixin	B-Language
is	O
simply	O
a	O
class	O
that	O
does	O
not	O
represent	O
an	O
is-a-type-of	O
relationship	O
.	O
</s>
<s>
Mixins	B-Language
are	O
typically	O
used	O
to	O
add	O
the	O
same	O
methods	B-Language
to	O
multiple	O
classes	O
;	O
for	O
example	O
,	O
a	O
class	O
might	O
provide	O
a	O
method	O
called	O
when	O
included	O
in	O
classes	O
and	O
that	O
do	O
not	O
share	O
a	O
common	O
parent	O
.	O
</s>
<s>
The	O
pieces	O
are	O
merged	O
at	O
compile-time	B-Application
,	O
making	O
compiler	O
output	O
the	O
same	O
as	O
for	O
a	O
non-partial	O
class	O
.	O
</s>
<s>
The	O
primary	O
motivation	O
for	O
introduction	O
of	O
partial	O
classes	O
is	O
to	O
facilitate	O
the	O
implementation	O
of	O
code	B-Application
generators	I-Application
,	O
such	O
as	O
visual	O
designers	O
.	O
</s>
<s>
It	O
is	O
otherwise	O
a	O
challenge	O
or	O
compromise	O
to	O
develop	O
code	B-Application
generators	I-Application
that	O
can	O
manage	O
the	O
generated	O
code	O
when	O
it	O
is	O
interleaved	O
within	O
developer-written	O
code	O
.	O
</s>
<s>
In	O
a	O
simple	O
implementation	O
of	O
partial	O
classes	O
,	O
the	O
compiler	O
can	O
perform	O
a	O
phase	O
of	O
precompilation	B-Application
where	O
it	O
"	O
unifies	O
"	O
all	O
the	O
parts	O
of	O
a	O
partial	O
class	O
.	O
</s>
<s>
Enables	O
separation	O
of	O
a	O
class	O
's	O
interface	B-Language
and	O
implementation	O
code	O
in	O
a	O
unique	O
way	O
.	O
</s>
<s>
Eases	O
navigation	O
through	O
large	O
classes	O
within	O
an	O
editor	B-Application
.	O
</s>
<s>
Enables	O
separation	O
of	O
concerns	O
,	O
in	O
a	O
way	O
similar	O
to	O
aspect-oriented	B-Architecture
programming	I-Architecture
but	O
without	O
using	O
any	O
extra	O
tools	O
.	O
</s>
<s>
Partial	O
classes	O
have	O
existed	O
in	O
Smalltalk	B-Application
under	O
the	O
name	O
of	O
Class	O
Extensions	O
for	O
considerable	O
time	O
.	O
</s>
<s>
With	O
the	O
arrival	O
of	O
the	O
.NET	B-Application
framework	I-Application
2	I-Application
,	O
Microsoft	O
introduced	O
partial	O
classes	O
,	O
supported	O
in	O
both	O
C#	B-Application
2.0	O
and	O
Visual	B-Language
Basic	I-Language
2005	I-Language
.	O
</s>
<s>
This	O
simple	O
example	O
,	O
written	O
in	O
Visual	B-Language
Basic	I-Language
.NET	I-Language
,	O
shows	O
how	O
parts	O
of	O
the	O
same	O
class	O
are	O
defined	O
in	O
two	O
different	O
files	O
.	O
</s>
<s>
In	O
Objective-C	B-Language
,	O
partial	O
classes	O
,	O
also	O
known	O
as	O
categories	O
,	O
may	O
even	O
spread	O
over	O
multiple	O
libraries	O
and	O
executables	B-Application
,	O
like	O
the	O
following	O
example	O
.	O
</s>
<s>
But	O
a	O
key	O
difference	O
is	O
that	O
Objective-C	B-Language
'	O
s	O
categories	O
can	O
overwrite	O
definitions	O
in	O
another	O
interface	B-Language
declaration	O
,	O
and	O
that	O
categories	O
are	O
not	O
equal	O
to	O
original	O
class	O
definition	O
(	O
the	O
first	O
requires	O
the	O
last	O
)	O
.	O
</s>
<s>
Instead	O
,	O
.NET	B-Application
partial	O
class	O
can	O
not	O
have	O
conflicting	O
definitions	O
,	O
and	O
all	O
partial	O
definitions	O
are	O
equal	O
to	O
the	O
others	O
.	O
</s>
<s>
In	O
user-supplied	O
library	O
,	O
a	O
separate	O
binary	O
from	O
Foundation	O
framework	B-Architecture
,	O
header	O
file	O
NSData+	O
base64.h	O
:	O
</s>
<s>
The	O
dispatcher	O
will	O
find	O
both	O
methods	B-Language
called	O
over	O
the	O
NSData	O
instance	O
and	O
invoke	O
both	O
of	O
them	O
correctly	O
.	O
</s>
<s>
Uninstantiable	O
classes	O
allow	O
programmers	O
to	O
group	O
together	O
per-class	O
fields	B-Application
and	O
methods	B-Language
that	O
are	O
accessible	O
at	B-Library
runtime	I-Library
without	O
an	O
instance	O
of	O
the	O
class	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
C#	B-Application
,	O
a	O
class	O
marked	O
"	O
static	O
"	O
can	O
not	O
be	O
instantiated	O
,	O
can	O
only	O
have	O
static	O
members	B-Application
(	O
fields	B-Application
,	O
methods	B-Language
,	O
other	O
)	O
,	O
may	O
not	O
have	O
instance	O
constructors	O
,	O
and	O
is	O
sealed	O
.	O
</s>
<s>
This	O
is	O
analogous	O
to	O
named	O
versus	O
unnamed	B-General_Concept
functions	I-General_Concept
.	O
</s>
<s>
Object	O
classes	O
often	O
facilitate	O
rapid	O
development	O
because	O
most	O
object-oriented	B-Language
environments	O
come	O
with	O
powerful	O
debugging	O
and	O
testing	O
tools	O
.	O
</s>
<s>
Instances	O
of	O
classes	O
can	O
be	O
inspected	O
at	O
run	B-Library
time	I-Library
to	O
verify	O
that	O
the	O
system	O
is	O
performing	O
as	O
expected	O
.	O
</s>
<s>
Also	O
,	O
rather	O
than	O
get	O
dumps	O
of	O
core	O
memory	O
,	O
most	O
object-oriented	B-Language
environments	O
have	O
interpreted	O
debugging	O
capabilities	O
so	O
that	O
the	O
developer	O
can	O
analyze	O
exactly	O
where	O
in	O
the	O
program	O
the	O
error	O
occurred	O
and	O
can	O
see	O
which	O
methods	B-Language
were	O
called	O
to	O
which	O
arguments	O
and	O
with	O
what	O
arguments	O
.	O
</s>
<s>
Object	O
classes	O
facilitate	O
ease	O
of	O
maintenance	O
via	O
encapsulation	B-Application
.	O
</s>
<s>
When	O
a	O
new	O
behavior	O
is	O
required	O
it	O
can	O
often	O
be	O
achieved	O
by	O
creating	O
a	O
new	O
class	O
and	O
having	O
that	O
class	O
inherit	O
the	O
default	O
behaviors	O
and	O
data	B-General_Concept
of	O
its	O
superclass	O
and	O
then	O
tailor	O
some	O
aspect	O
of	O
the	O
behavior	O
or	O
data	B-General_Concept
accordingly	O
.	O
</s>
<s>
Re-use	O
via	O
interfaces	O
(	O
also	O
known	O
as	O
methods	B-Language
)	O
occurs	O
when	O
another	O
object	O
wants	O
to	O
invoke	O
(	O
rather	O
than	O
create	O
a	O
new	O
kind	O
of	O
)	O
some	O
object	O
class	O
.	O
</s>
<s>
As	O
a	O
data	B-General_Concept
type	O
,	O
a	O
class	O
is	O
usually	O
considered	O
as	O
a	O
compile-time	B-Application
construct	O
.	O
</s>
<s>
A	O
language	O
or	O
library	O
may	O
also	O
support	O
prototype	B-Application
or	O
factory	B-Language
metaobjects	O
that	O
represent	O
run-time	B-Library
information	O
about	O
classes	O
,	O
or	O
even	O
represent	O
metadata	O
that	O
provides	O
access	O
to	O
reflection	B-Language
facilities	O
and	O
ability	O
to	O
manipulate	O
data	B-General_Concept
structure	I-General_Concept
formats	O
at	O
run-time	B-Library
.	O
</s>
<s>
Many	O
languages	O
distinguish	O
this	O
kind	O
of	O
run-time	B-Application
type	I-Application
information	I-Application
about	O
classes	O
from	O
a	O
class	O
on	O
the	O
basis	O
that	O
the	O
information	O
is	O
not	O
needed	O
at	O
run-time	B-Library
.	O
</s>
<s>
Some	O
dynamic	O
languages	O
do	O
not	O
make	O
strict	O
distinctions	O
between	O
run-time	B-Library
and	O
compile-time	B-Application
constructs	O
,	O
and	O
therefore	O
may	O
not	O
distinguish	O
between	O
metaobjects	O
and	O
classes	O
.	O
</s>
