Use methods and interfaces in Go

Beginner
Developer
Student
Azure

Learn about best practices for writing methods and interfaces in Go.

Learning objectives

In this module, you'll learn about:

  • How Go implements OOP principles such as encapsulation and composition.
  • How to write methods and why you use them.
  • How to write embedding and overloading methods.
  • How to write and use interfaces, and why they differ from interfaces in other programming languages.

Prerequisites

  • A Go environment that's ready to create applications. Ideally, you've installed and configured Go and Visual Studio Code with the Go extension.
  • Ability to create and modify .go files.
  • Ability to run Go applications by using the terminal prompt.
  • Knowledge of basic data types such as string, int, and boolean.
  • Knowledge of writing basic data control flows such as if and for statements.
  • Knowledge of writing functions.
  • Knowledge of creating structs.