Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Go
- type User struct {
- Username string
- password string
- }
- func (u User) GetPassword() string{
- return u.secretPassword()
- }
- func (u User) secretPassword() string {
- return u.password
- }
- func main(){
- user := User{"username", "password"}
- fmt.Println("username: " + user.Username)
- fmt.Println("password: " + user.GetPassword())
- }
Add Comment
Please, Sign In to add comment