package
0.0.0-20240712133535-75229b5999a3
Repository: https://github.com/agarwalconsulting/go-training.git
Documentation: pkg.go.dev

# README

Overview

Contrary to popular belief, go has inheritance through composition!

Inheritance

Struct

  • A struct type can compose another type

For eg.

type Bar string

func (b Bar) bar() {}

type Foo struct {
  Bar
  // Bar Bar
}
  • Here the custom type Foo "inherits" Bar's bar method

  • If a struct composes a struct, it can also "inherit" Fields

  • Multiple inheritance is possible

Interfaces

  • An interface can compose another interface

# Packages

No description provided by the author
No description provided by the author

# Structs

Car has-a Engine.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author