<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>GoLang - Tag - In a past life…</title>
        <link>https://archive.jtimothyking.com/tags/golang/</link>
        <description>GoLang - Tag - In a past life…</description>
        <generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Mon, 25 Jun 2018 21:27:41 &#43;0000</lastBuildDate><atom:link href="https://archive.jtimothyking.com/tags/golang/" rel="self" type="application/rss+xml" /><item>
    <title>Subclassing vs Embedding in GoLang</title>
    <link>https://archive.jtimothyking.com/2018/06/25/subclassing-vs-embedding-in-golang/</link>
    <pubDate>Mon, 25 Jun 2018 21:27:41 &#43;0000</pubDate>
    <author>J. Timothy King</author>
    <guid>https://archive.jtimothyking.com/2018/06/25/subclassing-vs-embedding-in-golang/</guid>
    <description><![CDATA[<figure class="alignright size-medium"><a class="lightgallery" href="/2018/06/25/subclassing-vs-embedding-in-golang/Golang.png" title="/2018/06/25/subclassing-vs-embedding-in-golang/Golang.png" data-thumbnail="/2018/06/25/subclassing-vs-embedding-in-golang/Golang.png">
        
    </a></figure>
<p>This is a topic that I&rsquo;ve seen pop up in discussions and articles about Go. The Go programming language does not support inheritance, but instead it supports composition via &ldquo;embedding.&rdquo;</p>
<p>It can be a little hard to grasp the difference. This is especially so if you&rsquo;ve worked in a language like C++, which implements inheritance by (literally) embedding the superclass object within the subclass object.</p>
<p>However, the semantics of Go&rsquo;s embedding fail to support inheritance in important ways, and there are other Go features and idioms that we use to implement inheritance semantics (or something like them).</p>]]></description>
</item>
</channel>
</rss>
