A Practical Example of Interfaces
This lesson provides an explanation of the use of interfaces for writing to the console by using a buffer.
We'll cover the following...
We'll cover the following...
The following program is a nice illustration of the concept of interfaces in io:
Here is the actual signature of fmt.Fprintf():
func Fprintf(w io.Writer, format string, a ...interface {}) (n int, err error)
It doesn’t write to a file, it writes to a variable of type io.Writer, that is: ...