I Tried To Write an Object-Oriented Program in a Non-OOP Language (Golang). Did I Succeed?



I Tried To Write an Object-Oriented Program in a Non-OOP Language (Golang). Did I Succeed?

I Tried To Write an Object-Oriented Program in a Non-OOP Language (Golang). Did I Succeed?

How can you create a class hierarchy in a language that doesn’t have classes? The Go (Golang) language doesn’t have classes and doesn’t do inheritance so when I tried to write an adventure game in Go, it looked as though I wouldn’t be able to get very far.

I’ve previously written adventure game sin object oriented languages such as Java and C#. In those languages I can create class hierarchies in which one class (say a Room) inherits the features of another class (say Thing) and adds on any new features. Go doesn’t let me do that…

…or does it?

In this video, I show how I created a ‘class hierarchy’ in Go even though it doesn’t have classes and so, in principle, it shouldn’t be possible to create a class hierarchy.

SUBSCRIBE TO THE CODE WITH HUW CHANNEL

To be notified whenever I upload new lessons, be sure to subscribe.
https://www.youtube.com/CodeWithHuw?sub_confirmation=1

IF YOU LIKED THIS, YOU MAY LIKE THESE…
Object Oriented Programming (From Smalltalk to Java – and beyond)
https://www.youtube.com/playlist?list=PLZHx5heVfgEvuveKG1T7BBSuDOTHl1eLl
The Complete Course In Adventure Game Programming (how to write one!)
https://www.youtube.com/playlist?list=PLZHx5heVfgEvThLmdx7KySZhCrdvDLmeQ
Go (Golang)
https://www.youtube.com/playlist?list=PLZHx5heVfgEsu66i76wx1wDBiXZLbMAFI

WHO IS HUW COLLINGBOURNE?

I’ve been programming since the early 1980s. I’ve written wrote programming columns on Java, C#, Delphi and other languages for “PC Plus Magazine”, “Computer Shopper” and numerous other UK magazines. I wrote the cult adventure game, The Golden Wombat Of Destiny, I have developed programming tools with SapphireSteel Software and I have written programming books published by Dark Neon and No Starch Press. These include books on programming C, C#, Java, Ruby, Delphi and Object Pascal, pointers, recursion and programming adventure games.
Find them all my books on Amazon.

Keep in Touch
==============================

Code With Huw on Facebook:
https://www.facebook.com/CodeWithHuw