Files
Douson/Zverushka/ZverushkaWithKlassovoVernim.py
BarsTigerMeowcat e87fc3780a 1
2020-03-13 14:25:18 +02:00

34 lines
897 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class Critter(object):
total = 0
@staticmethod
def status():
print("\nВсего зверюшек сейчас", Critter.total)
def __init__(self, name):
print("Появилась на свет новая зверюшка!")
self.name = name
Critter.total += 1
print("Нахожу значение атрибута клсса Critter.total:", end= " ")
crit1 = Critter("Барсик")
crit2 = Critter("Шарик")
print("Вывод объекта crit1 на экран: ")
print(crit1)
print("Непосредственный доступ к атрибуту crit1.name: ")
print(crit1.name)
print("\n")
print("Вывод объекта crit2 на экран: ")
print(crit2)
print("Непосредственный доступ к атрибуту crit2.name: ")
print(crit2.name)
input("\n\nНажмите Ent, чтобы выйти")