Sitemap
TechnoFunnel

We are focussed towards learning different technologies like React, Angular, Machine Learning, Python, Golang and AWS. Follow us for detailed conceptual understanding of these technologies and Interview Preparations.

Member-only story

Golang Object-Oriented Programming

6 min readNov 22, 2019

--

This article is focused on working with object-oriented architecture in Golang. We don’t have classes in Golang, so the only way to support the object-oriented model is to work with structs.

Creating Structs in Golang

Structs can be used to represent a complex object comprising multiple key-value pairs.

Let's look for a scenario: We want to represent an employee in our organization. In order to represent an employee, we require a combination of key-value pairs containing all of the the employee-related data. The employee entity can be comprised of multiple keys/properties, such as Name, Age, Designation, and Salary. All of these attributes/properties collectively represent a single employee in our organization.

Let's create a simple Employee dtruct with basic data properties.

The above code contains the following building blocks:

  1. The type keyword can be used to…

--

--

TechnoFunnel
TechnoFunnel

Published in TechnoFunnel

We are focussed towards learning different technologies like React, Angular, Machine Learning, Python, Golang and AWS. Follow us for detailed conceptual understanding of these technologies and Interview Preparations.

Mayank Gupta
Mayank Gupta

Written by Mayank Gupta

9 Years of Experience with Front-end Technologies and MEAN Stack. Working on all Major UI Frameworks like React, Angular and Vue https://medium.com/technofunnel

Responses (3)