Can a struct implement multiple interfaces in Go?

  • No, a struct can only implement one interface in Go.
  • Yes, a struct can implement multiple interfaces in Go.
  • Yes, but only if those interfaces have different methods.
  • Yes, but only if those interfaces have the same methods.
Yes, a struct in Go can implement multiple interfaces. This enables flexible code design where a single struct can fulfill the requirements of different interfaces, enhancing code reuse and modularity.
Add your answer
Loading...

Leave a comment

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