type Cat struct {
name string
age int
location string
}
func (cat Cat) Grow(){
fmt.Println("grow")
}
func (cat *Cat) Move(newLocation string) (oldLocation string) {
cat.location, oldLocation = newLocation, cat.location
return
}
name string
age int
location string
}
func (cat Cat) Grow(){
fmt.Println("grow")
}
func (cat *Cat) Move(newLocation string) (oldLocation string) {
cat.location, oldLocation = newLocation, cat.location
return
}
2018-04-26
type Person struct {
Name string
Gender string
Age uint8
Address string
}
func (p *Person) Move(newAddress string) string {
oldAddress := p.Address
p.Address = newAddress
return oldAddress
}
Name string
Gender string
Age uint8
Address string
}
func (p *Person) Move(newAddress string) string {
oldAddress := p.Address
p.Address = newAddress
return oldAddress
}
2018-04-18
type Pet interface {
Name() string
Age() uint8
}
type Dog struct {
N string
A uint8
}
func (dog Dog) Name() (string){
return dog.N
}
func (dog Dog) Age() (uint8){
return dog.A
}
func main() {
}
Name() string
Age() uint8
}
type Dog struct {
N string
A uint8
}
func (dog Dog) Name() (string){
return dog.N
}
func (dog Dog) Age() (uint8){
return dog.A
}
func main() {
}
2018-04-18
package main
import "fmt"
func main() {
...
...
length := (2)
capacity := (4)
...
...
...
length = (7)
...
...
...
e2 := (0)
e3 := (8)
e4 := (11)
...
}
记得加前两行
import "fmt"
func main() {
...
...
length := (2)
capacity := (4)
...
...
...
length = (7)
...
...
...
e2 := (0)
e3 := (8)
e4 := (11)
...
}
记得加前两行
2018-04-17
建议还是先看下基础(比如w3c),有了一定认识之后,来着做一下深化,老师已经讲的很透很全了,而且每个概念时间很短,建议把这个当成一个加深理解的教程,而不是go语言从入门到xxx
2018-04-14