interfaces-card-atm-bank example
Using interfaces to show how a bank card is used to interact with an atm and bank.
GitHub Webpage
OVERVIEW / GOAL
This is the bare bones minimum to really highlight interfaces.
For example, you could add pins, account numbers, a database. etc...
The goal is to create some interfaces for the bank, card and
atm machine respectively,
b1 := bank.NewBoaBank("elmStBranch")
c1 := bank.NewBoaCard(b1, "Jeff")
a1 := atm.NewATM("123Main")
Then add some accounts to the bank,
bank.NewBoaAccount(b1, "Jeff", 100)
Finally load the bank information in the atm machines,
atm.LoadBank(b1)
atm.LoadBank(b2)
Now we can use an atm machine with your card to do things,
atm.ShowBalance(a1, c1)
atm.Deposit(a1, c1, 740)
atm.Withdraw(a1, c1, 50)
This image shows the various functions and methods I made in my packages.
![IMAGE - interfaces-card-atm-bank - IMAGE](https://github.com/JeffDeCola/my-go-examples/raw/a2a1f0255beb/docs/pics/basic-syntax/interfaces-card-atm-bank.jpg)
RUN
Run,
go run insterfaces-card-atm-bank.go