<s>
In	O
object-oriented	B-Language
programming	I-Language
,	O
an	O
interface	O
or	O
protocol	O
type	O
is	O
a	O
data	O
type	O
describing	O
a	O
set	O
of	O
method	O
signatures	O
,	O
the	O
implementations	O
of	O
which	O
may	O
be	O
provided	O
by	O
multiple	O
classes	O
that	O
are	O
otherwise	O
not	O
necessarily	O
related	O
to	O
each	O
other	O
.	O
</s>
<s>
If	O
objects	O
are	O
fully	O
encapsulated	B-Application
then	O
the	O
protocol	O
is	O
the	O
only	O
way	O
in	O
which	O
they	O
may	O
be	O
accessed	O
by	O
other	O
objects	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Java	B-Language
,	O
the	O
Comparable	O
interface	O
specifies	O
a	O
method	O
compareTo( )	O
which	O
implementing	O
classes	O
must	O
implement	O
.	O
</s>
<s>
This	O
means	O
that	O
a	O
sorting	O
method	O
,	O
for	O
example	O
,	O
can	O
sort	O
a	O
collection	B-Application
of	O
any	O
objects	O
of	O
types	O
which	O
implement	O
the	O
Comparable	O
interface	O
,	O
without	O
having	O
to	O
know	O
anything	O
about	O
the	O
inner	O
nature	O
of	O
the	O
class	O
(	O
except	O
that	O
two	O
of	O
these	O
objects	O
can	O
be	O
compared	O
by	O
means	O
of	O
compareTo( )	O
)	O
.	O
</s>
<s>
Some	O
programming	O
languages	O
provide	O
explicit	O
language	O
support	O
for	O
protocols	O
(	O
Ada	B-Language
,	O
C#	B-Application
,	O
D	B-Application
,	O
Dart	B-Language
,	O
Delphi	B-Language
,	O
Go	B-Application
,	O
Java	B-Language
,	O
Logtalk	B-Language
,	O
Object	B-Language
Pascal	I-Language
,	O
Objective-C	B-Language
,	O
OCaml	B-Language
,	O
PHP	B-Application
,	O
Racket	B-Operating_System
,	O
Seed7	B-Language
,	O
Swift	B-Application
,	O
Python	B-Language
3.8	O
)	O
.	O
</s>
<s>
In	O
languages	O
supporting	O
multiple	B-Application
inheritance	I-Application
,	O
such	O
as	O
C++	B-Language
,	O
interfaces	O
are	O
implemented	O
as	O
abstract	O
classes	O
.	O
</s>
<s>
This	O
is	O
known	O
as	O
duck	B-Application
typing	I-Application
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Python	B-Language
,	O
any	O
class	O
can	O
implement	O
an	O
__iter__	O
method	O
and	O
be	O
used	O
as	O
a	O
collection	B-Application
.	O
</s>
<s>
Type	O
classes	O
in	O
languages	O
like	O
Haskell	B-Language
,	O
or	O
module	O
signatures	O
in	O
ML	B-Language
and	O
OCaml	B-Language
,	O
are	O
used	O
for	O
many	O
of	O
the	O
things	O
that	O
protocols	O
are	O
used	O
for	O
.	O
</s>
