Java |
Python |
public class Employee {
|
class Employee: '所有员工的基类' empCount = 0
def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCount += 1
def displayCount(self): print "Total Employee %d" % Employee.empCount
def displayEmployee(self): print "Name : ", self.name, ", Salary: ", self.salary
empCount静态变量 __init__构造器 self:this |
Java与python的面向对象对比
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/i973635025/article/details/82684789
猜你喜欢
转载自blog.csdn.net/i973635025/article/details/82684789
今日推荐
周排行