mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-29 06:56:03 +03:00
16 lines
298 B
Go
16 lines
298 B
Go
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
|
|
}
|