Multiple Inheritance
Explore how Go supports multiple inheritance by embedding multiple structs within a new type. Understand method delegation, naming conventions for idiomatic coding, and how Go's approach to polymorphism uses interfaces instead of classical inheritance hierarchies.
We'll cover the following...
Multiple inheritance is the ability for a type to obtain the behaviors of more than one parent class. In classical OO languages, it is usually not implemented (exceptions are C++ and Python), because, in class-based hierarchies, it introduces additional complexities for the compiler. But in Go, multiple inheritance can be implemented simply by embedding all the necessary ‘parent’ types in the type under construction.
Look at the following ...
In the above code, at line 4, we make a struct of type Camera ...