Skip to content

Commit

Permalink
Modify Visitor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer.Luo committed Aug 19, 2018
1 parent f86062c commit fedc81b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pattern/Visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def visit(self, book):
# 实战
# =======================================================================================================================
class Animal(DataNode):
"动物类"
"""动物类"""

def __init__(self, name, isMale, age, weight):
self.__name = name
Expand All @@ -127,7 +127,7 @@ def getWeight(self):
return self.__weight

class Cat(Animal):
""
"""猫"""

def __init__(self, name, isMale, age, weight):
super().__init__(name, isMale, age, weight)
Expand All @@ -137,7 +137,7 @@ def speak(self):


class Dog(Animal):
""
"""狗"""

def __init__(self, name, isMale, age, weight):
super().__init__( name, isMale, age, weight)
Expand All @@ -147,7 +147,7 @@ def speak(self):


class GenderCounter(Visitor):
"性别统计"
"""性别统计"""

def __init__(self):
self.__maleCat = 0
Expand All @@ -174,6 +174,7 @@ def getInfo(self):
+ str(self.__maleDog) + "只雄狗," + str(self.__femalDog) + "只雌狗。")

class WeightCounter(Visitor):
"""体重的统计"""

def __init__(self):
self.__catNum = 0
Expand All @@ -197,6 +198,7 @@ def getInfo(self):


class AgeCounter(Visitor):
"""年龄统计"""

def __init__(self):
self.__catMaxAge = 0
Expand Down

0 comments on commit fedc81b

Please sign in to comment.