September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
24
Task/Metaprogramming/Go/metaprogramming.go
Normal file
24
Task/Metaprogramming/Go/metaprogramming.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
type person struct{
|
||||
name string
|
||||
age int
|
||||
}
|
||||
|
||||
func copy(p person) person {
|
||||
return person{p.name, p.age}
|
||||
}
|
||||
|
||||
func main() {
|
||||
p := person{"Dave", 40}
|
||||
fmt.Println(p)
|
||||
q := copy(p)
|
||||
fmt.Println(q)
|
||||
/*
|
||||
is := []int{1, 2, 3}
|
||||
it := make([]int, 3)
|
||||
copy(it, is)
|
||||
*/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue