982:
78:
which implementing classes must implement. This means that a sorting method, for example, can sort a collection of any objects of types which implement the
Comparable interface, without having to know anything about the inner nature of the class (except that two of these objects can be compared by
287:
Usage of these terms varies by programming language. Java and languages derived from it tend to use "interface", while "protocol" is generally more popular elsewhere.
368:
63:
1023:
560:
565:
555:
550:
345:
268:
51:
that are otherwise not necessarily related to each other. A class which provides the methods listed in a protocol is said to
1047:
538:
439:
1042:
716:
258:
243:
997:
689:
182:
311:
806:
611:
543:
505:
192:
95:
1016:
223:
174:
151:
139:
107:
706:
636:
484:
147:
48:
169:
In languages without explicit support, protocols are often still present as conventions. This is known as
961:
596:
207:
115:
103:
67:
20:
584:
91:
894:
846:
758:
736:
731:
659:
525:
479:
196:
111:
1009:
768:
432:
238:
228:
99:
40:
66:
then the protocol is the only way in which they may be accessed by other objects. For example, in
921:
836:
664:
520:
474:
654:
629:
263:
989:
456:
155:
87:
8:
926:
904:
831:
684:
676:
425:
407:
382:
909:
889:
841:
816:
601:
570:
362:
356:
a protocol to help give it extra functionality to accomplish a particular set of tasks.
796:
726:
701:
515:
510:
341:
941:
826:
624:
253:
248:
233:
44:
946:
811:
763:
696:
993:
899:
721:
711:
619:
163:
1036:
821:
123:
778:
753:
956:
951:
801:
748:
575:
170:
127:
36:
861:
856:
773:
741:
646:
589:
188:
936:
914:
871:
866:
533:
489:
448:
32:
981:
851:
119:
203:, are used for many of the things that protocols are used for.
417:
200:
159:
143:
131:
469:
47:, the implementations of which may be provided by multiple
464:
135:
312:"Interfaces - define behavior for multiple types"
90:provide explicit language support for protocols (
1034:
306:
304:
1017:
433:
301:
1024:
1010:
440:
426:
375:
367:: CS1 maint: location missing publisher (
383:"Glossary — Python 3.11.0 documentation"
329:
1035:
340:. Indianapolis, Indiana. p. 263.
335:
421:
338:Sams Teach Yourself Swift in 24 hours
269:List of basic computer science topics
976:
13:
14:
1059:
259:Application programming interface
980:
244:Encapsulation (computer science)
162:, interfaces are implemented as
447:
400:
281:
154:3.8). In languages supporting
1:
506:Arbitrary-precision or bignum
408:"Traits - The Rust Reference"
294:
224:Concept (generic programming)
177:, any class can implement an
74:interface specifies a method
996:. You can help Knowledge by
7:
1048:Object-oriented programming
217:
21:object-oriented programming
10:
1064:
1043:Computer programming stubs
975:
195:, or module signatures in
880:
847:Strongly typed identifier
789:
675:
645:
610:
498:
455:
274:
239:Class (computer science)
234:Protocols in Objective-C
229:Delegation (programming)
210:, interfaces are called
181:method and be used as a
43:. It describes a set of
922:Parametric polymorphism
992:-related article is a
16:Abstraction of a class
264:Interface (computing)
88:programming languages
62:If objects are fully
990:computer-programming
156:multiple inheritance
55:the protocol, or to
927:Primitive data type
832:Recursive data type
685:Algebraic data type
561:Quadruple precision
336:Miller, BJ (2015).
316:learn.microsoft.com
890:Abstract data type
571:Extended precision
530:Reduced precision
191:in languages like
173:. For example, in
1005:
1004:
970:
969:
702:Associative array
566:Octuple precision
347:978-0-672-33724-6
45:method signatures
1055:
1026:
1019:
1012:
984:
977:
942:Type constructor
827:Opaque data type
759:Record or Struct
556:Double precision
551:Single precision
442:
435:
428:
419:
418:
412:
411:
404:
398:
397:
395:
393:
379:
373:
372:
366:
358:
333:
327:
326:
324:
322:
308:
288:
285:
254:Interface (Java)
249:Public interface
180:
164:abstract classes
82:
77:
73:
35:that acts as an
1063:
1062:
1058:
1057:
1056:
1054:
1053:
1052:
1033:
1032:
1031:
1030:
973:
971:
966:
947:Type conversion
882:
876:
812:Enumerated type
785:
671:
665:null-terminated
641:
606:
494:
451:
446:
416:
415:
410:. January 2024.
406:
405:
401:
391:
389:
387:docs.python.org
381:
380:
376:
360:
359:
348:
334:
330:
320:
318:
310:
309:
302:
297:
292:
291:
286:
282:
277:
220:
178:
80:
75:
71:
59:the interface.
17:
12:
11:
5:
1061:
1051:
1050:
1045:
1029:
1028:
1021:
1014:
1006:
1003:
1002:
985:
968:
967:
965:
964:
959:
954:
949:
944:
939:
934:
929:
924:
919:
918:
917:
907:
902:
900:Data structure
897:
892:
886:
884:
878:
877:
875:
874:
869:
864:
859:
854:
849:
844:
839:
834:
829:
824:
819:
814:
809:
804:
799:
793:
791:
787:
786:
784:
783:
782:
781:
771:
766:
761:
756:
751:
746:
745:
744:
734:
729:
724:
719:
714:
709:
704:
699:
694:
693:
692:
681:
679:
673:
672:
670:
669:
668:
667:
657:
651:
649:
643:
642:
640:
639:
634:
633:
632:
627:
616:
614:
608:
607:
605:
604:
599:
594:
593:
592:
582:
581:
580:
579:
578:
568:
563:
558:
553:
548:
547:
546:
541:
539:Half precision
536:
526:Floating point
523:
518:
513:
508:
502:
500:
496:
495:
493:
492:
487:
482:
477:
472:
467:
461:
459:
453:
452:
445:
444:
437:
430:
422:
414:
413:
399:
374:
346:
328:
299:
298:
296:
293:
290:
289:
279:
278:
276:
273:
272:
271:
266:
261:
256:
251:
246:
241:
236:
231:
226:
219:
216:
15:
9:
6:
4:
3:
2:
1060:
1049:
1046:
1044:
1041:
1040:
1038:
1027:
1022:
1020:
1015:
1013:
1008:
1007:
1001:
999:
995:
991:
986:
983:
979:
978:
974:
963:
960:
958:
955:
953:
950:
948:
945:
943:
940:
938:
935:
933:
930:
928:
925:
923:
920:
916:
913:
912:
911:
908:
906:
903:
901:
898:
896:
893:
891:
888:
887:
885:
879:
873:
870:
868:
865:
863:
860:
858:
855:
853:
850:
848:
845:
843:
840:
838:
835:
833:
830:
828:
825:
823:
822:Function type
820:
818:
815:
813:
810:
808:
805:
803:
800:
798:
795:
794:
792:
788:
780:
777:
776:
775:
772:
770:
767:
765:
762:
760:
757:
755:
752:
750:
747:
743:
740:
739:
738:
735:
733:
730:
728:
725:
723:
720:
718:
715:
713:
710:
708:
705:
703:
700:
698:
695:
691:
688:
687:
686:
683:
682:
680:
678:
674:
666:
663:
662:
661:
658:
656:
653:
652:
650:
648:
644:
638:
635:
631:
628:
626:
623:
622:
621:
618:
617:
615:
613:
609:
603:
600:
598:
595:
591:
588:
587:
586:
583:
577:
574:
573:
572:
569:
567:
564:
562:
559:
557:
554:
552:
549:
545:
542:
540:
537:
535:
532:
531:
529:
528:
527:
524:
522:
519:
517:
514:
512:
509:
507:
504:
503:
501:
497:
491:
488:
486:
483:
481:
478:
476:
473:
471:
468:
466:
463:
462:
460:
458:
457:Uninterpreted
454:
450:
443:
438:
436:
431:
429:
424:
423:
420:
409:
403:
388:
384:
378:
370:
364:
357:
355:
352:Any type can
349:
343:
339:
332:
317:
313:
307:
305:
300:
284:
280:
270:
267:
265:
262:
260:
257:
255:
252:
250:
247:
245:
242:
240:
237:
235:
232:
230:
227:
225:
222:
221:
215:
213:
209:
204:
202:
198:
194:
190:
186:
184:
176:
172:
167:
165:
161:
157:
153:
149:
145:
141:
137:
133:
129:
125:
124:Object Pascal
121:
117:
113:
109:
105:
101:
97:
93:
89:
84:
69:
65:
60:
58:
54:
50:
46:
42:
38:
34:
30:
26:
22:
998:expanding it
987:
972:
931:
727:Intersection
402:
390:. Retrieved
386:
377:
353:
351:
337:
331:
319:. Retrieved
315:
283:
211:
205:
189:Type classes
187:
168:
85:
64:encapsulated
61:
56:
52:
28:
24:
18:
957:Type theory
952:Type system
802:Bottom type
749:Option type
690:generalized
576:Long double
521:Fixed point
392:16 November
321:16 November
171:duck typing
128:Objective-C
81:compareTo()
76:compareTo()
37:abstraction
1037:Categories
862:Empty type
857:Type class
807:Collection
764:Refinement
742:metaobject
590:signedness
449:Data types
295:References
183:collection
158:, such as
72:Comparable
31:type is a
937:Subtyping
932:Interface
915:metaclass
867:Unit type
837:Semaphore
817:Exception
722:Inductive
712:Dependent
677:Composite
655:Character
637:Reference
534:Minifloat
490:Bit array
363:cite book
79:means of
57:implement
33:data type
25:interface
962:Variable
852:Top type
717:Equality
625:physical
602:Rational
597:Interval
544:bfloat16
218:See also
179:__iter__
29:protocol
905:Generic
881:Related
797:Boolean
754:Product
630:virtual
620:Address
612:Pointer
585:Integer
516:Decimal
511:Complex
499:Numeric
193:Haskell
120:Logtalk
49:classes
895:Boxing
883:topics
842:Stream
779:tagged
737:Object
660:String
344:
175:Python
152:Python
140:Racket
108:Delphi
70:, the
988:This
790:Other
774:Union
707:Class
697:Array
480:Tryte
354:adopt
275:Notes
212:trait
201:OCaml
148:Swift
144:Seed7
132:OCaml
86:Some
53:adopt
41:class
39:of a
23:, an
994:stub
910:Kind
872:Void
732:List
647:Text
485:Word
475:Trit
470:Byte
394:2022
369:link
342:ISBN
323:2022
208:Rust
199:and
116:Java
104:Dart
68:Java
769:Set
465:Bit
214:s.
206:In
160:C++
136:PHP
92:Ada
83:).
27:or
19:In
1039::
385:.
365:}}
361:{{
350:.
314:.
303:^
197:ML
185:.
166:.
150:,
146:,
142:,
138:,
134:,
130:,
126:,
122:,
118:,
114:,
112:Go
110:,
106:,
102:,
98:,
96:C#
94:,
1025:e
1018:t
1011:v
1000:.
441:e
434:t
427:v
396:.
371:)
325:.
100:D
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.