← All Exercises

Interface Implementation

basicgo~15min

Background

Go interfaces are satisfied implicitly, enabling flexible decoupling between types and behaviors.

Problem

Create an interface and implement it for multiple types demonstrating Go implicit interface satisfaction.

Input

Types with methods

Output

Polymorphic interface usage

Sample tests

Sample 1

Input: Shape interface for Circle and Square
Expected: shared Area method

Your solution

Learning objective

Learn Go interface design and polymorphism