02-usingInterface

command
v0.0.0-...-9882766 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package printsome for testing package interface boundary. The whole purpose if this program is to limit what variables and methods gets exported out of the package. Since the printerType is not exported its methods will not be exported either, but we will now export them via the new APrinter interface.

We then create an interface containing printerType's methods. The interface APrinter is exported, and will be available outside the package. Since we use the New() function which returns a not exported printerType via the APrinter interface type, we are able to export a private type via the exported interface type. All methods belonging to the interface type APrinter will be availabe to the new variable create in main.

Directories

Path Synopsis
Package printsome for testing package interface boundary.
Package printsome for testing package interface boundary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL