"Kanrika" python class

Introduction

Ever since I did hello world with python, I've been using object-oriented programming and the concept of classes. I want to understand it soon (complete understanding) and I will summarize it in my own way.

What is object-oriented?

There are too many horizontal terms such as objects, classes, instances, methods, overrides, intelligence, etc.! I remember the world history I did when I was in junior high school, like the Five Good Emperors ... (laughs)

Upon examination, it seems that objects and imperatives are paired concepts.

Imperative programming: Data and instructions are described and processed separately. ** Object-oriented: The idea of combining data and instructions, the idea of grouping variables and functions **

It seems to be an object-oriented outline to think about combining data and instructions that were processed separately. In addition, the "instruction" referred to here is called a "method".

** Differences between classes and functions ** are also considered to be in this respect.

class

You can see that object-oriented refers to thinking. That idea can be realized by using "classes". Classes are often compared to blueprints.

I think you can think of putting things called "data" and "instructions (methods)" in a box called a class.

I found the idea of data and methods easy to understand on this site.

instance

It's a familiar word for "creating an instance". An instance is an example, an example, an example, which is "generated" when you actually use a class.

If the class is a blueprint for a car, then the instance can be thought of as a more specific "Benz" or "Ferrari" blueprint. The class has an image that contains the instance, but is it correct ...?

I wonder if an instance will be a data framework (name, weight, etc.) defined in the class with specific numbers.

Class inheritance

Parent class to superclass Child classes are called subclasses

Creating a subclass using a superclass as a template is called inheritance. Subclasses can take advantage of superclass data and methods, as well as add other methods to extend their functionality. Also, rewriting a superclass method and overwriting it is called overriding.

Inheriting from multiple superclasses is called multiple inheritance.

Recommended Posts

"Kanrika" python class
[Python] class, instance
About python, class
Python class, instance
#Python basics (class)
Python class (Python learning memo ⑦)
case class in python
[Python] Class inheritance (super)
Python self-made class sort
[python] class basic methods
[Python] Class inheritance, override
python subprocess wrapper class
YOLO Python wrapper class
Class notation in Python
Python exception class list
Python: Class and instance variables
Python
C / C ++ programmer challenges Python (class)
class
Python class member scope summary
Python class variables and instance variables
class
How to write a Python class
perl objects and python class part 2.
[Python of Hikari-] Chapter 09-03 Class (inheritance)
Landmines hidden in Python class variables
Python class definitions and instance handling
"The easiest Python introductory class" modified
Read PNG chunks in Python (class)
[Python] Road to snake charmer (3) Python class
Examine the object's class in python
perl objects and python class part 1.
[Python] Inherit a class with class variables
kafka python
Generate a first class collection in Python
Python basics ⑤
python + lottery 6
Create a Python function decorator with Class
[Introduction to Python] How to use class in Python?
Python Summary
Built-in python
Python comprehension
Python technique
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
Implement __eq__ etc. generically in Python class
python tips
python function ①
Python basics
Python memo
[Learning memo] Basics of class by python
Build a blockchain with Python ① Create a class
ufo-> python (3)
Python comprehension
[Python] How to make a class iterable
install python
Python Singleton
Python basics ④
Python Memorandum 2