<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # **類定義** ``` using System;//使用命名空間 namespace 空間的名稱A { class A{ } class B{ } } namespace 空間的名稱B { class A{ } class B{ } } ``` ~~~ <訪問標識符,默認internal> class 類名><:基類> { // 成員變量 <訪問標識符,默認private> <變量數據類型> variable1; <訪問標識符,默認private> <變量數據類型> variable2; ... <訪問標識符,默認private> <變量數據類型> variableN; // 成員方法 <訪問標識符,默認private> <返回類型> method1(參數) { //code } <訪問標識符,默認private> <返回類型> method2(參數) { // code } ... <訪問標識符,默認private> <返回類型> methodN(參數) { // code } } ~~~ # **封裝** * public:所有對象都可以訪問; * private:對象本身在對象內部可以訪問; * protected:只有該類對象及其子類對象可以訪問 * internal:同一個程序集的對象可以訪問; * protected internal:訪問限于當前程序集或派生自包含類的類型。 ![](https://img.kancloud.cn/e4/a9/e4a9aae63ee7bfe3b7bdf84526fc49ad_240x239.png) **Internal 訪問修飾符** **詳解** Internal 訪問修飾符允許一個類將其成員變量和成員函數暴露給當前程序中的其他函數和對象。換句話說,帶有 internal 訪問修飾符的任何成員可以被定義在該成員所定義的應用程序內的任何類或方法訪問。 ~~~ using System; namespace RectangleApplication { class Rectangle { //成員變量 internal double length; internal double width; double GetArea() { return length * width; } public void Display() { Console.WriteLine("長度: {0}", length); Console.WriteLine("寬度: {0}", width); Console.WriteLine("面積: {0}", GetArea()); } }//end class Rectangle class ExecuteRectangle { static void Main(string[] args) { Rectangle r = new Rectangle(); r.length = 4.5; r.width = 3.5; r.Display(); Console.ReadLine(); } } } ~~~ **Protected Internal 訪問修飾符** Protected Internal 訪問修飾符允許在本類,派生類或者包含該類的程序集中訪問。這也被用于實現繼承。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看