Исходники и презентации
This commit is contained in:
15
lessons/generics_and_reflection/reflect_can_set/main.go
Normal file
15
lessons/generics_and_reflection/reflect_can_set/main.go
Normal file
@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var value float64 = 3.14
|
||||
v := reflect.ValueOf(value) // copy of value
|
||||
//v.SetFloat(2.7)
|
||||
//v.Addr()
|
||||
|
||||
fmt.Println("settability of v:", v.CanSet())
|
||||
}
|
||||
Reference in New Issue
Block a user