<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>interface on Golang</title><link>https://golang.k5kc.com/tags/interface/</link><description>Recent content in interface on Golang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 16 Aug 2020 00:12:00 +0530</lastBuildDate><atom:link href="https://golang.k5kc.com/tags/interface/index.xml" rel="self" type="application/rss+xml"/><item><title>Inheritance and Composition in GO</title><link>https://golang.k5kc.com/2020/08/16/3.inheritance-and-composition/</link><pubDate>Sun, 16 Aug 2020 00:12:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/3.inheritance-and-composition/</guid><description>Structs can &amp;ldquo;inherit&amp;rdquo; from other structs by a method known as embeding. Here is a simple example:
package main import ( &amp;#34;fmt&amp;#34; ) type a struct { Name string } //embeds a value of type a type b struct { a } //embeds a pointer to an a type c struct { *a } func main() { a := a{Name: &amp;#34;Janeway&amp;#34;} fmt.Println(a.Name) b := &amp;amp;b{a: a} fmt.Println(b.Name) c := &amp;amp;c{a: &amp;amp;a} fmt.</description></item><item><title>Interface in Go</title><link>https://golang.k5kc.com/2020/08/16/2.interface/</link><pubDate>Sun, 16 Aug 2020 00:11:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/2.interface/</guid><description>Intro We declare an Interface much like as we define a user defined type. Interfaces decouple different types from each other so we can create more maintainable programs.
More:
An Interface is a Protocol, a Contract.
Bigger the Interface the weaker the abstraction. &amp;ndash;&amp;gt; Rob Pike
It&amp;rsquo;s an abstract type. It doesn&amp;rsquo;t have any implementation. It only describes the expected behavior.
The opposite of Abstract Type is Concrete Type.
All the types in Go except Interface are of Concrete Type.</description></item></channel></rss>