<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                字段默認為 private ,意味著只有類和它的子類可以訪問它們。它們可以被聲明為公共字段,通過使用 public 訪問修飾符,使它們可以在各處訪問。 > Fields are by default private, meaning that only the class and its sub-classes may access them. They can be made public by using the public access modi?er, allowing access from anywhere. ~~~ class MyClass { static public function available() { unavailable(); } static private function unavailable() { } } class Main { static public function main() { MyClass.available(); // Cannot access private field unavailable MyClass.unavailable(); } } ~~~ MyClass類的可用字段的訪問允許從Main中訪問,因為它表示為 public。然而,當訪問不可用的字段訪問可以從類MyClass內部,但是不能從Main中訪問,因為它是private(明確的私有聲明,盡管這個標識符在這里是多余的) > Access to ?eld available of class MyClass is allowed from within Main because it is denoted as being public. However, while access to ?eld unavailable is allowed from within class MyClass, it is not allowed from within class Main because it is private (explicitly, although this identi?er is redundant here). 例子展示了static字段的可見性,但是成員字段的規則是等價的。下面的示例展示了當繼承(第2.3.2節)被使用時的可見性行為。 > The example demonstrates visibility through static ?elds, but the rules for member ?elds are equivalent. The following example demonstrates visibility behavior for when inheritance (2.3.2) is involved. ~~~ class Base { public function new() { } private function baseField() { } } class Child1 extends Base { private function child1Field() { } } class Child2 extends Base { public function child2Field() { var child1 = new Child1(); child1.baseField(); // Cannot access private field child1Field child1.child1Field(); } } class Main { static public function main() { } } ~~~ 我們可以看到訪問 child1.baseField() 是允許在Child2類中訪問,即使child1是不同的類型,Child1 。這是因為字段被定義在它們的通用祖先類Base,相反的,字段 Child1Field不能被從Child2中訪問。 > We can see that access to child1.baseField() is allowed from within Child2 even though child1 is of a different type,Child1. This is because the ?eld is de?ned on their common ancestor class Base, contrary to ?eld child1Field which can not be accessed from within Child2. 省略可見性的修飾符通常默認可見性為 private,但是有例外它會變成 public: > Omitting the visibility modi?er usually defaults the visibility to private, but there are exceptions where it becomes public instead: 1. 如果類被聲明為 extern 2. 如果字段被聲明在一個接口(第2.3.3節) 3. 如果字段重載(第4.3.1節)了一個 public 字段 > 1. If the class is declared as extern. > 2. If the ?eld is declared on an interface (2.3.3). > 3. If the ?eld overrides (4.3.1) a public ?eld. **Protected** >[warning] **花絮**:Protected Haxe沒有類似Java和C++等其它面向對象語言中的protected概念。然而,它的private行為等同于那些語言的protected行為,所以Haxe實際上缺少的是那些語言中的 private 行為。 >[warning] **Trivia**: Protected Haxe has no notion of a protected keyword known from Java, C++ and other object-oriented languages. However, its private behavior is equal to those language’s protected behavior, so Haxe actually lacks their real private behavior.
                  <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>

                              哎呀哎呀视频在线观看