go-pattern-examples/behavior/15_strategy/strategy_test.go

16 lines
298 B
Go
Raw Normal View History

2020-04-21 17:50:21 +03:00
package strategy
func ExamplePayByCash() {
payment := NewPayment("Ada", "", 123, &Cash{})
payment.Pay()
// Output:
// Pay $123 to Ada by cash
}
func ExamplePayByBank() {
payment := NewPayment("Bob", "0002", 888, &Bank{})
payment.Pay()
// Output:
// Pay $888 to Bob by bank account 0002
}