class NotAndGate extends Object{
    private $_key1;
    private $_key2;

    public function setKey1($value){
        $this->_key1 = $value;
    }

    public function setKey2($value){
        $this->_key2 = $value;
    }

    public function getOutput(){
        if (!$this->_key1 || !$this->_key2)
            return true;
        else if ($this->_key1 && $this->_key2)
            return false;
    }
}

与非门有两个输入,当两个输入都为真时,与非门的输出为假,否则,输出为真。上面的代码中,与非 门类有两个成员变量, $_key1$_key2 。但是有3个属性,表示2个输入的 key1key2 ,以及表示输出的 output

相关文章:

  • 2021-08-04
  • 2021-09-16
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2021-04-23
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2021-10-23
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
相关资源
相似解决方案