What is an Interface | Complete guide to Interface in Go/Golang

preview_player
Показать описание
- In general, an interface is a device or a system that unrelated entities use to interact.
- Interfaces are named collections of method signatures.
- EMPTY INTERFACE- When an interface has zero methods, it is called an empty interface. This is represented by interface{}. Since the empty interface has zero methods, all types implement this interface implicitly.
- TYPE ASSERTION- We can find out the underlying dynamic value of an interface using the syntax i.(Type) where i is a variable of type interface and Type is a type that implements the interface.
- EMBEDDING- In Go, an interface cannot implement other interfaces or extend them, but we can create a new interface by merging two or more interfaces.
- a method with pointer or value receiver can be called on both value and pointer and the conversion from value to a pointer or pointer to a value suitable to be passed as a receiver for the method call is done by Go under the hood.
Рекомендации по теме
Комментарии
Автор

nice video, but your mic is outside the room i guess

AnujTechShorts
Автор

very small fonts! ;-)
you have plenty of space on your screen !!
but good explanation!!

ekempinger
Автор

nice, but zoom in, you are coding in top left corner

kamalshkeir
welcome to shbcf.ru