Golang interface

Jimmy (xiaoke) Shen
1 min readSep 14, 2020

--

An interface type is defined as a set of method signatures.

Interface and OOP

Although methods are crucial to object-oriented programming, they’re only half the picture. To complete it, we need interfaces. from [1]

Some helpful articles and tutorials

Here are some articles or tutorials that we can explore more regarding the interface in Golang

Interfaces in Golang

Go language interfaces are different from other languages. In Go language, the interface is a custom type that is used to specify a set of one or more method signatures and the interface is abstract, so you are not allowed to create an instance of the interface. But you are allowed to create a variable of an interface type and this variable can be assigned with a concrete type value that has the methods the interface requires. Or in other words, the interface is a collection of methods as well as it is a custom type — geeksforfeeks

A tour of the interface in Golang

Polymorphism Using Interfaces

Interfaces in Go

Go: Understand the Empty Interface

Go Data Structures: Interfaces

Reference

[1] Go Programming Language, by Donovan Alan A. A. (Author), Kernighan Brian W.

--

--

No responses yet