Classes and Interfaces
Learn about the relationship between classes and interfaces in object-oriented design patterns.
Relationship between classes and interfaces
There is a very strong relationship between classes and interfaces, particularly in object-oriented design patterns. An interface describes a custom type and can include both properties and functions. A class is the definition of an object, also including its properties and functions. This allows us to use interfaces to describe some common behavior within a set of classes and write code that will work with this set of classes.
As an example of this, consider the following class definitions:
Get hands-on with 1200+ tech skills courses.