Created
December 23, 2010 20:32
-
-
Save mk0x9/753509 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type foo struct { | |
b int | |
c int | |
} | |
func (foo *foo) bar(a int) int { | |
fmt.Println(a + foo.b) | |
return a * foo.c | |
} | |
func (foo *foo) init() { | |
foo.b = 3 | |
foo.c = 5 | |
} | |
func main() { | |
f := new(foo) | |
f.init() | |
f.bar(1) | |
} |
iorlas
commented
Dec 23, 2010
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment