About python inheritance

Inheritance

Inheritance is to create a new class based on a certain class ** class New class name (original class name): You can define a new class by inheriting another class by writing **. The original class at this time is called the ** parent class **, and the new class is called the ** child class **. When inherited, the child class inherits the instance method of the parent class The child class can use both "methods defined in the parent class" and "methods defined independently". You can override the method by defining a method with the same name as the parent class in the child class. This is called the method ** override ** When overridden, the method defined in the child class takes precedence You can call the parent class by using ** super () ** in the overridden method. By using ** super (). method name () **, the instance method defined in the parent class can be used as it is.

Recommended Posts

About python inheritance
Python #inheritance (inheritance)
About python slices
About python yield
About python, class
About python, range ()
About python decorators
About python reference
About Python decorators
[Python] About multi-process
About Python for loops
Summary about Python scraping
About function arguments (python)
[Python] Class inheritance (super)
[Python] Memo about functions
Summary about Python3 + OpenCV3
[Python] Class inheritance, override
About Python, for ~ (range)
About Python3 character code
[Python] Memo about errors
About Python development environment
Python: About function arguments
Python, about exception handling
About Python Pyramid traversal
About Python3 ... (Ellipsis object)
[Python] Chapter 01-01 About Python (First Python)
[Python] About standard input
About __all__ in python
[Python] Find out about pip
About Fabric's support for Python 3
Python
About python objects and classes
About Python variables and objects
About the Python module venv
About python beginner's memorandum function
About the ease of Python
About the enumerate function (python)
About various encodings of Python 3
About Python, len () and randint ()
About Perl, Python, PHP, Ruby
About Python datetime and timezone
A memorandum about correlation [Python]
[python] super (), inheritance, __init__, etc.
A memorandum about Python mock
About Python string comparison operators
About Python and regular expressions
About the features of Python
About "for _ in range ():" in python
About Python and os operations
Python # About reference and copy
About Python sort () and reverse ()
A note about [python] __debug__
Python Note: About comparison using is
About installing Pwntools and Python2 series
[Python of Hikari-] Chapter 09-03 Class (inheritance)
Python: A Note About Classes 1 "Abstract"
[Python] Let's write briefly about comprehensions
About python dict and sorted functions
About dtypes in Python and Cython
[Python] What is @? (About the decorator)
What was surprising about Python classes