sajad torkamani

A simple interface

An interface type is a set of method signatures:

type Animal interface {
	MakeSound() string
}

The empty interface

The interface type that specifies zero methods is known as the empty interface:

interface{}

An empty interface can hold values of any type because every type implements at least zero methods.

Empty interfaces are typically by code that needs to handle values of an unknown type.

Tagged: Golang