Python通过类来实现逻辑电路
发布时间
阅读量:
阅读量
class LogicGate:
def __init__(self, n):
self.label = n
self.output = None
def getLael(self):
return self.label
def getOutput(self):
self.output = self.performGateLogic() # 该方法并未定义,在创建子类的时候定义
return self.output
class BinaryGate(LogicGate):
def __init__(self, n):
super().__init__(n)
self.pinA = None
self.pinB = None
def getpinA(self):
if self.pinA: # 配合连接器时新增
return s
全部评论 (0)
还没有任何评论哟~
