_______ in Go allows a struct to anonymously embed other structs.

  • Aggregation
  • Composition
  • Inheritance
  • Polymorphism
Composition in Go refers to the ability to embed one struct within another struct. This feature allows the outer struct to inherit the fields and methods of the embedded struct, enabling code reuse and modular design without explicitly using inheritance.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *