Pass by Reference as "essential" to swap method exposed as a lie

  • Thread starter Thread starter raylopez99
  • Start date Start date
Family said:
That code does not compile, as Booleans (boolean is not defined), can
not be multiplied or added.

Operator '*' cannot be applied to operands of type 'bool' and 'bool'
C:\...\Program.cs 24 9 SwapCode
Operator '+' cannot be applied to operands of type 'bool' and 'bool'
C:\...\Program.cs 24 9 SwapCode

* and + are "and" and "or" operations in conventional notation. C, C++, C#,
Java all use "&" and "|" for this.

Note the remaining problem with the uninitialized variable.

But he did indeed get DeMorgan's theorem wrong, it is:

/(A + B) = (/A) * (/B)

or in C# style

!(A | B) == (!A) & (!B)

The identity holds for all combinations of boolean A and B
 
Isn't that what I said?

No, you said "binary systems of base 2", implying that binary numbering
could use some other base number.
 
Back
Top