Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- type test struct {
- value int
- }
- //type Test interface {
- // changeValue(newValue int)
- // getValue() int
- //}
- func (tst *test) changeValue(newValue int) {
- tst.value = newValue
- }
- func (tst *test) getValue() int {
- return tst.value
- }
- func main() {
- var lol test
- lol = test{value:0}
- fmt.Println(lol.getValue())
- lol.changeValue(1)
- fmt.Println(lol.getValue())
- change(lol)
- fmt.Println(lol.getValue())
- }
- func change(tst test){
- tst.changeValue(2)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement