Hi 

I have seen this example somewhere but i modified it :

package main

import "fmt"

type notifier interface {
notify()
}

type duration int

func (d *duration) notify() {
fmt.Println("Sending Notification in", *d)
}

func main() {
var n notifier
var i int = 42
n = &duration(i)
n.notify()
}


but i get the following error message :


prog.go:17:6: cannot take the address of duration(i)



Why ? i is a variable with address in memory (it works :

var i int = 42
var p * int
p=&i

)

Thank you in advance Attila



-- 
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