FAQ
Hi,

If I have an interface A and a pointer to a struct B that suffices the
definition of A, I can do this:

var a A = new(B)

But I can't do this:

var map[string]A = make(map[string]*B)

Is this a way to make this kind of thing happen so that I can
functions that consume a map of A's, and fire maps of any type that
suffices the A contract into them?

Cheers,

Ben

PS Here's the play: http://play.golang.org/p/XSRW80bcRj

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 18, '13 at 9:53a
activeNov 18, '13 at 10:20a
posts2
users2
websitegolang.org

2 users in discussion

Ben Hood: 1 post Jan Mercl: 1 post

People

Translate

site design / logo © 2021 Grokbase