- Class is a blueprint/template of an object.
- Each class has its own attributes (its states) and methods (its behaviors).
- Object is a bundle of related attributes and methods.
- Instance is a single and unique unit of a class.
- Many instances may have the same class. They have attributes and methods defined in the class.
Syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. For example, we use
arr[i,j] but behind the scene, it's get_element(arr, vector(i,j)).my_object.method('foo') means MyClass.method(my_object, 'foo'). That's why we need self or a decoratorSuppose that we have a folders/files structure like below,
We want import both classes
ABC and XYZJust add
__init__.py like in the right box above.Some errors may occur,
If you want son takes all parameters of father and use additional parameters,