<?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%2FC_Sharp%2FClass_Interface%2FOverloading_Method</id>
		<title>Csharp/C Sharp/Class Interface/Overloading Method - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FClass_Interface%2FOverloading_Method"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Overloading_Method&amp;action=history"/>
		<updated>2026-04-29T17:30:03Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Overloading_Method&amp;diff=556&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Overloading_Method&amp;diff=556&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</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/C_Sharp/Class_Interface/Overloading_Method&amp;diff=557&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Overloading_Method&amp;diff=557&amp;oldid=prev"/>
				<updated>2010-05-26T11:38:53Z</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;==Illustrates method overloading==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Mastering Visual C# .NET&lt;br /&gt;
by Jason Price, Mike Gunderloy&lt;br /&gt;
Publisher: Sybex;&lt;br /&gt;
ISBN: 0782129110&lt;br /&gt;
*/&lt;br /&gt;
/*&lt;br /&gt;
  Example5_9.cs illustrates method overloading&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// declare the Swapper class&lt;br /&gt;
class Swapper&lt;br /&gt;
{&lt;br /&gt;
  // this Swap() method swaps two int parameters&lt;br /&gt;
  public void Swap(ref int x, ref int y)&lt;br /&gt;
  {&lt;br /&gt;
    int temp = x;&lt;br /&gt;
    x = y;&lt;br /&gt;
    y = temp;&lt;br /&gt;
  }&lt;br /&gt;
  // this Swap() method swaps two float parameters&lt;br /&gt;
  public void Swap(ref float x, ref float y)&lt;br /&gt;
  {&lt;br /&gt;
    float temp = x;&lt;br /&gt;
    x = y;&lt;br /&gt;
    y = temp;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Example5_9&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    // create a Swapper object&lt;br /&gt;
    Swapper mySwapper = new Swapper();&lt;br /&gt;
    // declare two int variables&lt;br /&gt;
    int intValue1 = 2;&lt;br /&gt;
    int intValue2 = 5;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;initial intValue1 = &amp;quot; + intValue1 +&lt;br /&gt;
      &amp;quot;, intValue2 = &amp;quot; + intValue2);&lt;br /&gt;
    // swap the two float variables&lt;br /&gt;
    // (uses the Swap() method that accepts int parameters)&lt;br /&gt;
    mySwapper.Swap(ref intValue1, ref intValue2);&lt;br /&gt;
    // display the final values&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;final   intValue1 = &amp;quot; + intValue1 +&lt;br /&gt;
      &amp;quot;, intValue2 = &amp;quot; + intValue2);&lt;br /&gt;
    // declare two float variables&lt;br /&gt;
    float floatValue1 = 2f;&lt;br /&gt;
    float floatValue2 = 5f;&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;initial floatValue1 = &amp;quot; + floatValue1 +&lt;br /&gt;
      &amp;quot;, floatValue2 = &amp;quot; + floatValue2);&lt;br /&gt;
    // swap the two float variables&lt;br /&gt;
    // (uses the Swap() method that accepts float parameters)&lt;br /&gt;
    mySwapper.Swap(ref floatValue1, ref floatValue2);&lt;br /&gt;
    // display the final values&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;final   floatValue1 = &amp;quot; + floatValue1 +&lt;br /&gt;
      &amp;quot;, floatValue2 = &amp;quot; + floatValue2);&lt;br /&gt;
    mySwapper.Swap(ref floatValue1, ref floatValue2);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operator Overloading==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
public class Rectangle {&lt;br /&gt;
    public int width;&lt;br /&gt;
    public int height;&lt;br /&gt;
    public Rectangle(int width, int height) {&lt;br /&gt;
        this.width = width;&lt;br /&gt;
        this.height = height;&lt;br /&gt;
    }&lt;br /&gt;
    public override string ToString() {&lt;br /&gt;
        return &amp;quot;width = &amp;quot; + width + &amp;quot;, height = &amp;quot; + height;&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator ==(Rectangle lhs, Rectangle rhs) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;In operator ==&amp;quot;);&lt;br /&gt;
        if (lhs.width == rhs.width &amp;amp;&amp;amp; lhs.height == rhs.height) {&lt;br /&gt;
            return true;&lt;br /&gt;
        } else {&lt;br /&gt;
            return false;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public static bool operator !=(Rectangle lhs, Rectangle rhs) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;In operator !=&amp;quot;);&lt;br /&gt;
        return !(lhs == rhs);&lt;br /&gt;
    }&lt;br /&gt;
    public override bool Equals(object obj) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;In Equals()&amp;quot;);&lt;br /&gt;
        if (!(obj is Rectangle)) {&lt;br /&gt;
            return false;&lt;br /&gt;
        } else {&lt;br /&gt;
            return this == (Rectangle)obj;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public static Rectangle operator +(Rectangle lhs, Rectangle rhs) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;In operator +&amp;quot;);&lt;br /&gt;
        return new Rectangle(&lt;br /&gt;
          lhs.width + rhs.width, lhs.height + rhs.height);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
class MainClass {&lt;br /&gt;
    public static void Main() {&lt;br /&gt;
        Rectangle myRectangle = new Rectangle(1, 4);&lt;br /&gt;
        Console.WriteLine(&amp;quot;myRectangle: &amp;quot; + myRectangle);&lt;br /&gt;
        Rectangle myRectangle2 = new Rectangle(1, 4);&lt;br /&gt;
        Console.WriteLine(&amp;quot;myRectangle2: &amp;quot; + myRectangle2);&lt;br /&gt;
        if (myRectangle == myRectangle2) {&lt;br /&gt;
            Console.WriteLine(&lt;br /&gt;
              &amp;quot;myRectangle is equal to myRectangle2&amp;quot;);&lt;br /&gt;
        } else {&lt;br /&gt;
            Console.WriteLine(&lt;br /&gt;
              &amp;quot;myRectangle is not equal to myRectangle2&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        Rectangle myRectangle3 = myRectangle + myRectangle2;&lt;br /&gt;
        Console.WriteLine(&amp;quot;myRectangle3: &amp;quot; + myRectangle3);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overloaded methods with identical signatures cause compilation errors, even if return types are different. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public class MethodOverloadError&lt;br /&gt;
{&lt;br /&gt;
   public int Square( int x )&lt;br /&gt;
   {&lt;br /&gt;
      return x * x;&lt;br /&gt;
   }&lt;br /&gt;
   public double Square( int y )&lt;br /&gt;
   {&lt;br /&gt;
      return y * y;&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>