<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FOperator_Overload%2FLogic_Operator_Overload</id>
		<title>Csharp/CSharp Tutorial/Operator Overload/Logic Operator Overload - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FOperator_Overload%2FLogic_Operator_Overload"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator_Overload/Logic_Operator_Overload&amp;action=history"/>
		<updated>2026-04-30T08:39:33Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator_Overload/Logic_Operator_Overload&amp;diff=6402&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator_Overload/Logic_Operator_Overload&amp;diff=6402&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator_Overload/Logic_Operator_Overload&amp;diff=6403&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Operator_Overload/Logic_Operator_Overload&amp;diff=6403&amp;oldid=prev"/>
				<updated>2010-05-26T12:18:55Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Complex number with logic operators==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
public struct Complex : IComparable, IEquatable&amp;lt;Complex&amp;gt;, IComparable&amp;lt;Complex&amp;gt;{&lt;br /&gt;
    public Complex( double real, double img ) {&lt;br /&gt;
        this.real = real;&lt;br /&gt;
        this.img = img;&lt;br /&gt;
    }&lt;br /&gt;
    public override bool Equals( object other ) {&lt;br /&gt;
        bool result = false;&lt;br /&gt;
        if( other is Complex ) {&lt;br /&gt;
            result = Equals( (Complex) other );&lt;br /&gt;
        }&lt;br /&gt;
        return result;&lt;br /&gt;
    }&lt;br /&gt;
    public bool Equals( Complex that ) {&lt;br /&gt;
        return (this.real == that.real &amp;amp;&amp;amp; this.img == that.img);&lt;br /&gt;
    }&lt;br /&gt;
    public override int GetHashCode() {&lt;br /&gt;
        return (int) this.Magnitude;&lt;br /&gt;
    }&lt;br /&gt;
    public int CompareTo( Complex that ) {&lt;br /&gt;
        int result;&lt;br /&gt;
        if( Equals( that ) ) {&lt;br /&gt;
            result = 0;&lt;br /&gt;
        } else if( this.Magnitude &amp;gt; that.Magnitude ) {&lt;br /&gt;
            result = 1;&lt;br /&gt;
        } else {&lt;br /&gt;
            result = -1;&lt;br /&gt;
        }&lt;br /&gt;
        return result;&lt;br /&gt;
    }&lt;br /&gt;
    int IComparable.rupareTo( object other ) {&lt;br /&gt;
        if( !(other is Complex) ) {&lt;br /&gt;
            throw new ArgumentException( &amp;quot;Bad Comparison&amp;quot; );&lt;br /&gt;
        }&lt;br /&gt;
        return CompareTo( (Complex) other );&lt;br /&gt;
    }&lt;br /&gt;
    public override string ToString() {&lt;br /&gt;
        return String.Format( &amp;quot;({0}, {1})&amp;quot;, real, img );&lt;br /&gt;
    }&lt;br /&gt;
    public double Magnitude {&lt;br /&gt;
        get {&lt;br /&gt;
            return Math.Sqrt( Math.Pow(this.real, 2) + Math.Pow(this.img, 2) );&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator==( Complex lhs, Complex rhs ) {&lt;br /&gt;
        return lhs.Equals( rhs );&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator!=( Complex lhs, Complex rhs ) {&lt;br /&gt;
        return !lhs.Equals( rhs );&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator&amp;lt;( Complex lhs, Complex rhs ) {&lt;br /&gt;
        return lhs.rupareTo( rhs ) &amp;lt; 0;&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator&amp;gt;( Complex lhs, Complex rhs ) {&lt;br /&gt;
        return lhs.rupareTo( rhs ) &amp;gt; 0;&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator&amp;lt;=( Complex lhs, Complex rhs ) {&lt;br /&gt;
        return lhs.rupareTo( rhs ) &amp;lt;= 0;&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator&amp;gt;=( Complex lhs, Complex rhs ) {&lt;br /&gt;
        return lhs.rupareTo( rhs ) &amp;gt;= 0;&lt;br /&gt;
    }&lt;br /&gt;
    private double real;&lt;br /&gt;
    private double img;&lt;br /&gt;
}&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    static void Main() {&lt;br /&gt;
        Complex cpx1 = new Complex( 1.0, 3.0 );&lt;br /&gt;
        Complex cpx2 = new Complex( 1.0, 2.0 );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 = {0}, cpx1.Magnitude = {1}&amp;quot;, cpx1, cpx1.Magnitude );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx2 = {0}, cpx2.Magnitude = {1}\n&amp;quot;, cpx2, cpx2.Magnitude );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 == cpx2 ? {0}&amp;quot;, cpx1 == cpx2 );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 != cpx2 ? {0}&amp;quot;, cpx1 != cpx2 );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 &amp;lt;  cpx2 ? {0}&amp;quot;, cpx1 &amp;lt; cpx2 );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 &amp;gt;  cpx2 ? {0}&amp;quot;, cpx1 &amp;gt; cpx2 );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 &amp;lt;= cpx2 ? {0}&amp;quot;, cpx1 &amp;lt;= cpx2 );&lt;br /&gt;
        Console.WriteLine( &amp;quot;cpx1 &amp;gt;= cpx2 ? {0}&amp;quot;, cpx1 &amp;gt;= cpx2 );&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;cpx1 = (1, 3), cpx1.Magnitude = 3.16227766016838&lt;br /&gt;
cpx2 = (1, 2), cpx2.Magnitude = 2.23606797749979&lt;br /&gt;
cpx1 == cpx2 ? False&lt;br /&gt;
cpx1 != cpx2 ? True&lt;br /&gt;
cpx1 &amp;lt;  cpx2 ? False&lt;br /&gt;
cpx1 &amp;gt;  cpx2 ? True&lt;br /&gt;
cpx1 &amp;lt;= cpx2 ? False&lt;br /&gt;
cpx1 &amp;gt;= cpx2 ? True&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Point: Overloaded Operators==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
public struct Point : IComparable {&lt;br /&gt;
    private int x, y;&lt;br /&gt;
    public Point(int xPos, int yPos) {&lt;br /&gt;
        x = xPos;&lt;br /&gt;
        y = yPos;&lt;br /&gt;
    }&lt;br /&gt;
    public static Point operator +(Point p1, Point p2) { return new Point(p1.x + p2.x, p1.y + p2.y); }&lt;br /&gt;
    public static Point operator -(Point p1, Point p2) { return new Point(p1.x - p2.x, p1.y - p2.y); }&lt;br /&gt;
    public static bool operator ==(Point p1, Point p2) { return p1.Equals(p2); }&lt;br /&gt;
    public static bool operator !=(Point p1, Point p2) { return !p1.Equals(p2); }&lt;br /&gt;
    public static bool operator &amp;lt;(Point p1, Point p2) { return (p1.rupareTo(p2) &amp;lt; 0); }&lt;br /&gt;
    public static bool operator &amp;gt;(Point p1, Point p2) { return (p1.rupareTo(p2) &amp;gt; 0); }&lt;br /&gt;
    public static bool operator &amp;lt;=(Point p1, Point p2) { return (p1.rupareTo(p2) &amp;lt;= 0); }&lt;br /&gt;
    public static bool operator &amp;gt;=(Point p1, Point p2) { return (p1.rupareTo(p2) &amp;gt;= 0); }&lt;br /&gt;
    public static Point operator ++(Point p1) { return new Point(p1.x + 1, p1.y + 1); }&lt;br /&gt;
    public static Point operator --(Point p1) { return new Point(p1.x - 1, p1.y - 1); }&lt;br /&gt;
    public override bool Equals(object o) {&lt;br /&gt;
        if (o is Point) {&lt;br /&gt;
            if (((Point)o).x == this.x &amp;amp;&amp;amp;&lt;br /&gt;
                ((Point)o).y == this.y)&lt;br /&gt;
                return true;&lt;br /&gt;
        }&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
    public override int GetHashCode() { return this.ToString().GetHashCode(); }&lt;br /&gt;
    public override string ToString() {&lt;br /&gt;
        return string.Format(&amp;quot;[{0}, {1}]&amp;quot;, this.x, this.y);&lt;br /&gt;
    }&lt;br /&gt;
    public int CompareTo(object obj) {&lt;br /&gt;
        if (obj is Point) {&lt;br /&gt;
            Point p = (Point)obj;&lt;br /&gt;
            if (this.x &amp;gt; p.x &amp;amp;&amp;amp; this.y &amp;gt; p.y)&lt;br /&gt;
                return 1;&lt;br /&gt;
            if (this.x &amp;lt; p.x &amp;amp;&amp;amp; this.y &amp;lt; p.y)&lt;br /&gt;
                return -1;&lt;br /&gt;
            else&lt;br /&gt;
                return 0;&lt;br /&gt;
        } else&lt;br /&gt;
            throw new ArgumentException();&lt;br /&gt;
    }&lt;br /&gt;
    public static Point Add(Point p1, Point p2) { return p1 + p2; }&lt;br /&gt;
    public static Point Subtract(Point p1, Point p2) { return p1 - p2; }&lt;br /&gt;
}&lt;br /&gt;
class Program {&lt;br /&gt;
    static void Main(string[] args) {&lt;br /&gt;
        Point ptOne = new Point(100, 100);&lt;br /&gt;
        Point ptTwo = new Point(40, 40);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne = {0}&amp;quot;, ptOne);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptTwo = {0}&amp;quot;, ptTwo);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne + ptTwo: {0} &amp;quot;, ptOne + ptTwo);&lt;br /&gt;
        Console.WriteLine(&amp;quot;Point.Add(ptOne, ptTwo): {0} &amp;quot;, Point.Add(ptOne, ptTwo));&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne - ptTwo: {0} &amp;quot;, ptOne - ptTwo);&lt;br /&gt;
        Console.WriteLine(&amp;quot;Point.Subtract(ptOne, ptTwo): {0} &amp;quot;, Point.Subtract(ptOne, ptTwo));&lt;br /&gt;
        Point ptThree = new Point(90, 5);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptThree = {0}&amp;quot;, ptThree);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptThree += ptTwo: {0}&amp;quot;, ptThree += ptTwo);&lt;br /&gt;
        Point ptFour = new Point(0, 500);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptFour = {0}&amp;quot;, ptFour);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptFour -= ptThree: {0}&amp;quot;, ptFour -= ptThree);&lt;br /&gt;
        Point ptFive = new Point(10, 10);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptFive = {0}&amp;quot;, ptFive);&lt;br /&gt;
        Console.WriteLine(&amp;quot;++ptFive = {0}&amp;quot;, ++ptFive);&lt;br /&gt;
        Console.WriteLine(&amp;quot;--ptFive = {0}&amp;quot;, --ptFive);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne == ptTwo : {0}&amp;quot;, ptOne == ptTwo);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne != ptTwo : {0}&amp;quot;, ptOne != ptTwo);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne &amp;lt; ptTwo : {0}&amp;quot;, ptOne &amp;lt; ptTwo);&lt;br /&gt;
        Console.WriteLine(&amp;quot;ptOne &amp;gt; ptTwo : {0}&amp;quot;, ptOne &amp;gt; ptTwo);&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>