DEV Community

sunday4me
sunday4me

Posted on

How to use knowledge of OOP in Go

Using the Simple Knowledge of OOP to Build simple classes for the following “objects” in Go

The following Objects are use

  1. Car
  2. Product
  3. Store

The Car class can have any car attributes you can think of.
The Product class should have attributes of a product i.e (the product, quantity of the product in stock, price of the product). A car is a product of the store, but there can be other products so the attribute of the car can be promoted to the Product. The Product class should have methods to display a product, and a method to display the status of a product if it is still in stock or not.

The Store class should have attributes like
Number of products in the store that are still up for sale
Adding an Item to the store
Listing all product items in the store
Sell an item
Show a list of sold items and the total price

Kindly Click Here to view the complete Project and how to Implement the simple OOP in Golang

Top comments (0)