GoStructs

Introduction

Structs are sets of various variables packed together. The struct itself is only a package containing variables and making them easily accessible.

Unlike in C, Go's structs can have methods attached to them. It also allows them to implement interfaces. That makes Go's structs similar to objects, but they are (probably intentionally) missing some major features known in object oriented languages like inheritance.

Related Examples

Anonymous struct