I getting the error not enough arguments in call to method expression AccountService.Open
when I run the following. Run here: https://play.golang.org/p/Z9y-QIcwNy
type AccountService interface {
Open(no string, name string, openingDate time.Time) AccountService
}
type Account struct {
Num string
Name string
OpenDate time.Time
Balance float64
}
type SavingsAccount struct {
InterestRate float32
Account
}
type CheckingAccount struct {
TransactionFee float32
Account
}
func (a SavingsAccount) Open(no string, name string, openingDate time.Time) AccountService {
return SavingsAccount{
Account: Account{Num: no,
Name: name,
OpenDate: openingDate,
},
InterestRate: 0.9,
}
}
func (a CheckingAccount) Open(no string, name string, openingDate time.Time) AccountService {
return CheckingAccount{
Account: Account{Num: no,
Name: name,
OpenDate: openingDate,
},
TransactionFee: 0.15,
}
}
func main() {
aliceAcct := AccountService.Open("12345", "Alice", time.Date(1999, time.January, 03, 0, 0, 0, 0, time.UTC))
fmt.Println("Alice's account =", aliceAcct)
}