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.
Loading...
Related Quiz
- You're developing a web application in Go that interacts with a database. Would you use methods for performing CRUD (Create, Read, Update, Delete) operations on database entities? Discuss the advantages and disadvantages of this approach.
- What format is commonly used for data interchange in Go?
- Which operator in Go is used to concatenate strings?
- How would you implement a custom Stringer interface for a struct in Go?
- What is the difference between buffered and unbuffered channels in Go?