Files

533 B

05 — Interfejsy i Kompozycja („OOP po Go-owemu”)

W Go nie ma dziedziczenia klas — jest embedding (kompozycja struktur) oraz niejawne interfejsy (typ spełnia interfejs automatycznie, jeśli ma wymagane metody).

Zadania (interfaces.go)

  1. EmailNotifier i SmsNotifier spełniające interfejs Notifier.
  2. AlertService.Broadcast(msg string) []string — wywołuje Format(msg) dla każdego notifiera.

Uruchomienie testów

make test PKG=./exercises/01-core/05-interfaces-composition