FAQ
Hi,

    I'm curious of the conversion of interfaces. Here is the
example http://play.golang.org/p/i0cOBhpAym
    In that example,
      interface B defines a method returning an interface A, and
      struct C implement a method returning a pointer to struct CA which
implements interface A.

    I wonder why Go can't deduce interface B from C.
    If *interface A, B* and *struct C, CA* are in different package, then
the only way to make it possible is either
     - refine the method of *C.Get* to *func Get() A*, this means I need to
import the definition of interface A from other package and introduce more
dependency, or
     - refine the method *Get* of C and B to *func Get() interface{}*

    Can anyone give me some hint or clue?



--
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/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 29, '15 at 2:14p
activeJul 30, '15 at 4:59a
posts4
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase