March 2020
Intermediate to advanced
406 pages
8h 39m
English
Go does not have inheritance. Composition is used in order to embed items (mostly structs) in one another. This is convenient when you have a baseline struct that is used for many different functions, with other structs that build on top of the initial struct.
We can describe some of the items in my kitchen to show how inheritance works.
We can initialize our program as shown in the following code block. In this block, we create two structs:
Utensils: For the utensils I have in my drawers in my kitchen
Appliances: For the appliances I have in my kitchen
package mainimport "fmt" func main() { type Utensils struct { fork string spoon string knife string } type Appliances struct { stove string dishwasher string ...Read now
Unlock full access