12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package main
- import "fmt"
- type Book struct {
- title, author string
- pages int
- }
- func main() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
-
- type Book struct {
- pages int
- }
- book1 := &Book{100}
- book2 := new(Book)
- fmt.Println(book1, book2)
-
- book2.pages = book1.pages
- fmt.Println(book1.pages == book2.pages)
-
-
- (*book2).pages = (*book1).pages
- }
- }
|