> On Dec 31, 2020, at 15:10, Axel Wagner <axel.wagner...@googlemail.com> wrote: > > On Thu, Dec 31, 2020 at 9:27 PM Alex Besogonov <alex.besogo...@gmail.com > <mailto:alex.besogo...@gmail.com>> wrote: > Moreover, Go has inheritance as well (struct embedding and interface > inheritance), making it a fairly typical example. > > Interfaces yes (though I would use "subtyping", not "inheritance", but potato > tomato), but struct embedding, no. Embedding a type doesn't make a struct > usable as that type, so it's not subtyping (and notably, methods are still > called on the embedded type). Yes, it does make it usable. See: https://play.golang.org/p/IqxpujkqXnO <https://play.golang.org/p/IqxpujkqXnO>
There’s simply no automatic upcasting. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/C484E8FD-1DC3-4604-866F-80F27A49F357%40gmail.com.