Forem

Cover image for Golang perk series : structs & partial inheritance with embedded structs #6.1
LG
LG

Posted on • Edited on

2 1

Golang perk series : structs & partial inheritance with embedded structs #6.1

TL;DR : Sructs in Go enables us to define custom types , yes I said type*S* (in plural!), upon which is passed type checking on build (compile-time) can instantiate "object-like" blueprint of data : hereby I mentioned "object-like" as we going to compared "non-comparable" with JavaScript objects mocking struct-like behaviour, whilst utilising a small extendible utility called – _is I've recently written for this purpose (the later example) :

In Golang :

TIP : refer to structs_factory.go on REPLIT IDE in File Explorer

Meanwhile in JavaScript :

TIP : refer to structs_factory.js on REPLIT IDE in File Explorer

Top comments (1)

Collapse
 
projektorius96 profile image
LG

Upvoted for 6.1 ed. which included a code example of "embbeded" (optionally anonymous) structs

Stay tuned for more !

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay