23 lines
360 B
Go
23 lines
360 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
)
|
|
|
|
type Human struct {
|
|
name string
|
|
age int
|
|
phone string
|
|
}
|
|
|
|
// Human implemented fmt.Stringer
|
|
func (h Human) String() string {
|
|
return "Name:" + h.name + ", Age:" + strconv.Itoa(h.age) + " years, Contact:" + h.phone
|
|
}
|
|
|
|
func main() {
|
|
Bob := Human{"Bob", 39, "000-7777-XXX"}
|
|
fmt.Println("This Human is : ", Bob)
|
|
}
|