Table of Contents
Protocol (object-oriented programming)
Return to Swift Protocols - Swift Protocol-Oriented Programming - Swift POP, Swift, Protocol-Oriented Programming
See:
- Snippet from Wikipedia: Interface (object-oriented programming)
In object-oriented programming, an interface or protocol type is a data type that acts as an abstraction of a class. It describes a set of method signatures, the implementations of which may be provided by multiple classes that are otherwise not necessarily related to each other. A class which provides the methods listed in an interface is said to implement the interface, or to adopt the protocol.
If objects are fully encapsulated then the interface is the only way in which they may be accessed by other objects. For example, in Java, the
Comparable
interface specifies a methodcompareTo()
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 means ofcompareTo()
).
Fair Use Sources
OOP: Category OOP, Object (computer science), Object-orientation, Object-oriented programming (OOP), Comparison of programming languages (object-oriented programming), Comparison of programming paradigms, Component-based software engineering, Design by contract, Object association, Object database, Object model reference, Object modeling language, Object-oriented analysis and design, Object-relational impedance mismatch (and The Third Manifesto), Object-relational mapping, Protocol-Oriented Programming - Protocol (object-oriented programming) - Swift Protocol-Oriented Programming. (navbar_oop)
Cloud Monk is Retired ( for now). Buddha with you. © 2025 and Beginningless Time - Present Moment - Three Times: The Buddhas or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.