General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dr Gamma D
Indently
comments
Comments by "Dr Gamma D" (@DrDeuteron) on "What is Polymorphism in Python?" video.
Note that if there is any shared computations for the payment types, you can put that code in the abstract method and call super in the concrete classes’ payment method. Idk about other languages, but in python, you can call abstract methods that are bound to ABCs from their concrete extensions in concrete sub classes.
3
Has-A is better than Is-A
2
Are protocols enforced? I mean python won’t let you instantiate a class with abstract methods.
2
@ wait, how “it” is achieved ….do you mean how to use inheritance?
1
4:09 you can create the class without the abstract method, you just can’t instantiate from it.
1
Classes sub “object” and make instances. Metaclasses sub “type” and make classes. Much of what you might do with a meta class can be accomplished with a class decorator. There is also a factory pattern that allows a meta class’s dunder new method to take instance parameters and pick the correct class to make the instance.
1