hello my dear friend Google man:
    I have some questions.

type Point struct{
    x int
   y  int
}

func (p *Point) hehe(i  int) {
  p.x = i
  p.y = i
}

func main(){
  Point{1,2}.hehe(4) // compile error: can't take address of Point literal
}

The book says that there’s no way to obtain the address of a temporary value.

but
 ( &Point{1,2}).hehe(4)  //sucessed

why & can obtain the address of a temporay value?

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to