下面的代码为什么一直显示错误?
class Company(object):
num = 0
name = []
def __init__(self,Company_name,Desc,Profit,TotalSales,TotalCost,EmployeeName):
self.Company_name = Company_name
self.Desc = Desc
self.Profit = Profit
self.TotalSales = TotalSales
self.TotalCost = TotalCost
self.EmployeeName = EmployeeName
self.Employee_number = len(self.EmployeeName)
self.class.num += 1#为什么这里一直显示错误?
self.class.name.append(Company_name)
def recuitment(self,r_name,r_salary):
self.EmployeeName.append(r_name)
self.TotalCost += r_salary
self.Employee_number += 1
def fire(self,f_name,f_salary):
self.EmployeeName.remove(f_name)
self.TotalCost -=f_salary
self.Employee_number -= 1
def advertise(self,ad_cost):
self.TotalCost += ad_cost
def s_security(self,s_cost):
self.TotalCost += s_cost*self.Employee_number
def tax(self,t_cost):
self.TotalCost += t_cost*self.Employee_number
def sale(self,sale_number,price,Profit_rate,):
self.Totalsales += sale_number*price
self.Profit+= sale_number*Profit_rate
def get_employee(self):
return self.EmployeeName
def get_profit(self):
return self.Profit
@classmethod
def get_num(cls):
return cls.num
@classmethod
def get_name(cls):
return cls.name