Python Online Compiler & Playground
HTML/CSS/JavaScript
HTML
CSS
Javascript
C++
C
PHP
Java
Python
Swift
C#
Ruby
Node.JS
Kotlin
jQuery
Go
R
TypeScript
Начать курс Python
Регистрация
My first object oriented programming!!!
+39
Автор: Daniel
Тёмный
Публичный
Сохранить
PY
py
1
2
3
4
5
6
7
8
9
10
11
class
Employee
():
new_id =
1
def
__init__
(
self
):
self
.
id
= Employee.new_id
Employee.new_id +=
1
def
say_id
(
self
):
print
(
"my id is {}"
.
format
(
self
.
id
))
e1=Employee
()
e2=Employee
()
e1.say_id
()
e2.say_id
()
Enter to Rename, Shift+Enter to Preview
OUTPUT