<?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%2FClass%2Fpublic</id>
		<title>Csharp/CSharp Tutorial/Class/public - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FClass%2Fpublic"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Class/public&amp;action=history"/>
		<updated>2026-04-29T21:48:59Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Class/public&amp;diff=5633&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/Class/public&amp;diff=5633&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/Class/public&amp;diff=5634&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Class/public&amp;diff=5634&amp;oldid=prev"/>
				<updated>2010-05-26T12:16:04Z</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;==Public vs private access==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;It is OK for a member of a class to access a private member of the same class.&amp;lt;/p&amp;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;
 &lt;br /&gt;
class MyClass {  &lt;br /&gt;
  private int a; // private access explicitly specified &lt;br /&gt;
  int b;          // private access by default &lt;br /&gt;
  public int gamma;  // public access &lt;br /&gt;
   &lt;br /&gt;
  public void setAlpha(int val) { &lt;br /&gt;
    a = val;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public int getAlpha() { &lt;br /&gt;
    return a; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void setBeta(int a) { &lt;br /&gt;
    b = a;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public int getBeta() { &lt;br /&gt;
    return b; &lt;br /&gt;
  } &lt;br /&gt;
}  &lt;br /&gt;
  &lt;br /&gt;
class AccessDemo {  &lt;br /&gt;
  public static void Main() {  &lt;br /&gt;
    MyClass ob = new MyClass();  &lt;br /&gt;
  &lt;br /&gt;
    /* Access to a and b is allowed only through methods. */ &lt;br /&gt;
    ob.setAlpha(-99); &lt;br /&gt;
    ob.setBeta(19); &lt;br /&gt;
    Console.WriteLine(&amp;quot;ob.a is &amp;quot; + ob.getAlpha()); &lt;br /&gt;
    Console.WriteLine(&amp;quot;ob.b is &amp;quot; + ob.getBeta()); &lt;br /&gt;
 &lt;br /&gt;
    // You cannot access a or b like this: &lt;br /&gt;
//  ob.a = 10; // Wrong! a is private! &lt;br /&gt;
//  ob.b = 9;   // Wrong! b is private! &lt;br /&gt;
 &lt;br /&gt;
    // It is OK to directly access gamma because it is public. &lt;br /&gt;
    ob.gamma = 99;  &lt;br /&gt;
   }  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;ob.a is -99&lt;br /&gt;
ob.b is 19&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Re-using Base Class Identifiers==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;class Point2D&lt;br /&gt;
{&lt;br /&gt;
    public int X;&lt;br /&gt;
    public int Y;&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
class Point3D : Point2D&lt;br /&gt;
{&lt;br /&gt;
    public int X;&lt;br /&gt;
    public int Y;&lt;br /&gt;
    public int Z;&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
class MyMainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Point2D My2DPoint = new Point2D();&lt;br /&gt;
        Point3D My3DPoint = new Point3D();&lt;br /&gt;
   &lt;br /&gt;
        My2DPoint.X = 100;&lt;br /&gt;
        My2DPoint.Y = 200;&lt;br /&gt;
   &lt;br /&gt;
        My3DPoint.X = 150;&lt;br /&gt;
        My3DPoint.Y = 250;&lt;br /&gt;
        My3DPoint.Z = 350;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use an access modifier with an accessor==&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;
  &lt;br /&gt;
class MySequence {   &lt;br /&gt;
  int prop;   &lt;br /&gt;
  &lt;br /&gt;
  public MySequence() { prop = 0; }  &lt;br /&gt;
  &lt;br /&gt;
  public int MyProp {  &lt;br /&gt;
    get {  &lt;br /&gt;
      return prop;  &lt;br /&gt;
    }  &lt;br /&gt;
    private set { // private  &lt;br /&gt;
      prop = value;  &lt;br /&gt;
    }   &lt;br /&gt;
  }  &lt;br /&gt;
 &lt;br /&gt;
  public void increaseSequence() { &lt;br /&gt;
    MyProp++; &lt;br /&gt;
  } &lt;br /&gt;
}   &lt;br /&gt;
 &lt;br /&gt;
class MainClass {   &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
    MySequence ob = new MySequence();  &lt;br /&gt;
  &lt;br /&gt;
    Console.WriteLine(&amp;quot;Original value of ob.MyProp: &amp;quot; + ob.MyProp);  &lt;br /&gt;
  &lt;br /&gt;
    ob.increaseSequence(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Value of ob.MyProp after increment: &amp;quot; &lt;br /&gt;
                      + ob.MyProp);  &lt;br /&gt;
  }  &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Original value of ob.MyProp: 0&lt;br /&gt;
Value of ob.MyProp after increment: 1&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>