python 创建类的实例对象

 

 

 1 # -*- coding: UTF-8 -*-
 2 class Employee:
 3 
 4     def __init__(self, name, salary):
 5         self.name = name
 6         self.salary = salary
 7     
 8     def displayCount(self):
 9         pass
10     def displayEmployee(self):
11         pass

 

"创建 Employee 类的第一个对象"
emp1 = Employee("Zara", 2000)
"创建 Employee 类的第二个对象"
emp2 = Employee("Manni", 5000)

 

posted @ 2018-10-08 20:32  nnniki  阅读(4036)  评论(0编辑  收藏  举报