Explaining coding with gun analogy from @arrionknight

The creator explains the programming concept of Object-Oriented Programming (OOP) and inheritance in Python by using an extended analogy involving firearms. He first defines a base "gun" class with basic shooting functionality, then creates a specialized subclass that inherits the base features but adds a new "full-auto" function. He demonstrates how one type of gun (a Glock) can be an instance of this specialized class to gain the new functionality, while another (a revolver) cannot, thereby illustrating the principles of classes, objects, and inheritance.

Creator: @arrionknight on Instagram

Transcript

Twin, you can't put a switch on tier revolver, but you good put a switch on the Glock. And this is why we got ops, best oriented programming languages. See, good. If we create a class called blick, we see every blick has a name and it has rank ammo count. And in this class, we create a function called shoot to shoot our blick. But we best shoot in it regular. We don't got a switch on tier. And we create two blicks, a revolver with a ammo count of six and a g 17 with a ammo count of 17. And if we

Topics: Tech, Education

4,965,189 views