Structs, Interfaces and Maps
This lesson is a flashback to the standard operations and their syntaxes defined on structs, interfaces, and maps.
We'll cover the following...
📝 Useful code snippets for structs
Creation
type struct1 struct {
field1 type1
field2 type2
...
}
ms := new(struct1)
Initialization
ms := &struct1{10, 15.5, "Chris"}
Capitalize the first letter of the struct name to make it visible outside its package. Often, it is better to define a factory function for the struct and force using that. ...