# class BMI:
# def __init__(self,name,weight,high):
# self.name=name
# self.__weight=weight
# self.__high=high
# def fn(self):
# s=self.__weight/(self.__high**2)
# if s<18.5:
# print("过轻")
# elif s<23.9:
# print("正常")
# elif s<27:
# print("过重")
# elif s<32:
# print("肥胖")
# else:
# print("非常肥胖")
# @property
# def Bmi(self):
# return self.__weight/(self.__high**2)
#
# a=BMI("张敏聪",78,1.76)
# print(a.Bmi)
# class People:
# name="123"
# __num=2
# def __init__(self,name,age):
# self.name=name
# self.__age = age if type(age) is int else print("你输入的年龄类型有误")
# @property
# def age(self):
# return self.__age
# @age.setter
# def age(self,value):
# self.__age = value if type(value)is int else print("你输入的年龄类型有误")
# @age.deleter
# def age(self):
# del self.__age
# @classmethod
# def fn(cls):
# print(cls.__num)
# @staticmethod
# def func():
# print(666)
# p1=People("zhang",21)
# print(p1.age)
# # print(p1._People__age)
# p1.age=20
# print(p1.age)
# print(p1.__dict__)
# del p1.age
# print(p1.__dict__)
# People.fn()
# People.func()
class A:
@classmethod
def fn(cls):
print(cls.name)
class Game(A):
name="lol"
__players="两亿"
def __init__(self,people,game):
self.people=people
self.__game=game
@property
def game(self):
return self.__game
@game.setter
def game(self,value):
self.__game=value
@game.deleter
def game(self):
del self.__game
@staticmethod
def func():
print("无关函数")
p=Game("五个","MOB")
Game.fn()
p.game="A"
del p.game
print(p.__dict__)