Skip to content

Commit e3e4de1

Browse files
committed
✨ (bitcoin-wallet): add value receiver function, but failed
1 parent 05a2b77 commit e3e4de1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package pointers_and_errors
22

3-
// type Wallet struct {
4-
// }
3+
type Wallet struct {
4+
balance int
5+
}
56

6-
// func (w Wallet) Deposit(amount int) {}
7+
func (w Wallet) Deposit(amount int) {
8+
w.balance += amount
9+
}
710

8-
// func (w Wallet) Balance() int {
9-
// return 0
10-
// }
11+
func (w Wallet) Balance() int {
12+
return w.balance
13+
}

0 commit comments

Comments
 (0)