現實就是現實 要理解現狀並且分析 在那其中一定會有導致現狀的原因 對原因有了充分認識之後再根據詞付諸行動就好 連現狀都不懂得判斷的人 再我看來就是白痴
需要的資訊和資訊源:~/desktop/python_learningload/python_class/employee.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# v2.7
# macos10.13.6
class
employee:
empcount = 0
def__init__
(self, name, salary):
self.name = name
self.salary = salary
employee.empcount += 1
defdisplaycount
(self):
print
"total employee %d" % employee.empcount
defdisplayemployee
(self):
print
"name : ", self.name, ", salary: ", self.salary
xiaomi = employee('xiaomi',8000)
xiaomi.displayemployee()
~/desktop/python_learningload/python_class/employee.py
class
employee:
empcount = 0
def__init__
(self, name, salary):
self.name = name
self.salary = salary
employee.empcount += 1
defdisplaycount
(self):
print
"total employee %d" % employee.empcount
defdisplayemployee
(self):
print
"name : ", self.name, ", salary: ", self.salary
~/desktop/python_learningload/python_class/employee.py
xiaomi = employee('xiaomi',8000)
~/desktop/python_learningload/python_class/employee.py
def
__init__
(self, name, salary):
self.name = name
self.salary = salary
employee.empcount += 1
cd ~desktop/python_learningload/python_class/python employee.py
name : xiaomi , salary: 8000
~/desktop/python_learningload/python_class/class_employee.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# v2.7
# macos10.13.6
class
employee:
empcount = 0
def__init__
(self, name, salary):
self.name = name
self.salary = salary
employee.empcount += 1
defdisplaycount
(self):
print
"total employee %d" % employee.empcount
defdisplayemployee
(self):
print
"name : ", self.name, ", salary: ", self.salary
~/desktop/python_learningload/python_class/show_employee.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# v2.7
# macos10.13.6
from class_employee import employee
xiaomi = employee('xiaomi',8000)
xiaomi.displayemployee()
cd ~desktop/python_learningload/python_class/python show_employee.py
python元類的使用 Python 元類使用講解
我要一大群的類都具有一種特點,我怎麼給他們加上呢?模板嘛,我從這個模板建立一群類不就ok了?那就需要元類了。定義乙個元類 就是乙個類的模板!莫多想,還要記住這是類級別的,不是物件級別的!如下 class mymeta type def init cls,name,bases,dic print cl...
Python中collections類使用(1)
counter是乙個dict子類,主要是用來對需要訪問的物件的頻率進行計數。在collections類中用的也是比較多的一種操作方式。from collections import counter colors red blue red green blue blue c counter color...
5 2 MFC的類層次
書籍 mfc 微軟基礎類 也是一種應用程式框架,定義了應用程式的一般處理流程,用於對windows api實現基於物件導向技術的封裝,隱藏在windows下使用c 程式設計的大量內部細節。在開發應用程式的過程中,程式設計人員可以通過對類庫中已有類的繼承,生成功能更加強大的類庫以供自己所用。在mfc中...