/trunk/Examples/test-suite/go/smart_pointer_simple_runme.go

# · Go · 19 lines · 15 code · 4 blank · 0 comment · 4 complexity · 699f93409aec1b97cd6fa1b589415a5f MD5 · raw file

  1. package main
  2. import . "./smart_pointer_simple"
  3. func main() {
  4. f := NewFoo()
  5. b := NewBar(f)
  6. b.SetX(3)
  7. if b.Getx() != 3 {
  8. panic(0)
  9. }
  10. fp := b.X__deref__()
  11. fp.SetX(4)
  12. if fp.Getx() != 4 {
  13. panic(0)
  14. }
  15. }