Polymorphism with Golang Interfaces

Polymorphism with Golang Interfaces…

Mayank Gupta
TechnoFunnel
Published in
4 min readDec 11, 2019

--

Interfaces in Golang works in a completely different way as compared to Interfaces in other server-side languages. This document will be guiding you with the use cases and scenarios for Golang Interfaces. Before getting in the depth of the Interfaces in Golang, let's start with basic concepts first. Interfaces in Golang provides a list of Function Signatures that are required to be implemented by any “struct” in order to work with specified Interfaces. Let's see what we mean by the above statement below.

If you are new to Golang, probably you need to give the reading to the following article before you start with this one…

Features of Interfaces:

  1. Interfaces define the functional contract
  2. Interfaces are Types in Golang

Let's define a simple Interface for an Employee…

--

--

Mayank Gupta
TechnoFunnel

9 Years of Experience with Front-end Technologies and MEAN Stack. Working on all Major UI Frameworks like React, Angular and Vue https://medium.com/technofunnel