상세 컨텐츠

본문 제목

파이썬 클래스 개념

파이썬

by somiyuralove 2023. 4. 17. 20:11

본문

Python Classes/Objects

Python is an object oriented programming language.

Almost everything in Python is an object, with its properties and methods.

A Class is like an object constructor, or a "blueprint" for creating objects.

Create a Class
To create a class, use the keyword class:


Create Object
Now we can use the class named FooClass to create objects:

The __init__() Function
The examples above are classes and objects in their simplest form, and are not really useful in real life applications.

To understand the meaning of classes we have to understand the built-in __init__() function.

All classes have a function called __init__(), which is always executed when the class is being initiated.

Use the __init__() function to assign values to object properties, or other operations that are necessary to do when the object is being created:


* reference and super thanks : w3schools.com

'파이썬' 카테고리의 다른 글

파이썬 detetime 모듈 개념  (0) 2023.04.16
파이썬 모듈의 개념  (0) 2023.04.14
파이썬 상속 개념  (0) 2023.04.14
format  (0) 2023.04.12

관련글 더보기

댓글 영역