Satisfying Interfaces

This lesson discusses implicit interfaces and how Go interfaces are satisfied.

We'll cover the following

Implicit Interfaces

A type implements an interface by implementing the methods that it contains.

There is no explicit declaration of intent. The interfaces are satisfied implicitly through its methods.

Implicit interfaces decouple implementation packages from the packages that define the interfaces: neither depends on the other.

It also encourages the definition of precise interfaces, because you don’t have to find every implementation and tag it with the new interface name.

Given below is an example implementation of Reader and Writer interfaces in Go:

Get hands-on with 1200+ tech skills courses.