Python的工廠模式和單例模式

工廠模式: 解耦 定義類或方法,讓其功能越單一越好python #!/usr/bin/python #coding:utf-8 class Cake(): def __init__(self,weidao="默認"): self.taste=weidao class AppleCake(object): def __init__(self,weidao="蘋果"
相關文章
相關標籤/搜索