Implement the Close() method

Report a typo

You need to implement the io.Closer interface. Below you can take a look at its definition:

type Closer interface {
    Close() error
}

The task is simple — you need to implement a method Close() for the FunnyBox struct. ThisClose() method should print the string "Bey!" and return a nil error.

Write a program in Go
package main

import (
"fmt"
"io"
)

type FunnyBox struct {
}

// Create the `Close()` method for the `FunnyBox` struct below:


// DO NOT delete or modify the code within the main() function!
// nolint: gosimple // DO NOT delete this comment!
func main() {
var c io.Closer
c = &FunnyBox{}
c.Close()
}
___

Create a free account to access the full topic