How are interfaces implemented in Go?
- By using structs
- Explicitly
- Implicitly
- Through inheritance
Interfaces in Go are implemented implicitly. A type implements an interface if it provides implementations for all the methods declared by the interface, without explicitly declaring it.
Loading...
Related Quiz
- Describe a real-world scenario where you would need to use file locking in Go.
- A common practice in Go is to design small, _____ interfaces for easier mocking and testing.
- You are tasked with building a RESTful API using the Gin framework. How would you organize your project to ensure scalability and maintainability?
- Which function is commonly used in Go to handle errors by logging them and exiting the program?
- How does Go handle package visibility and encapsulation?