<i id='ONuiN'><tr id='ONuiN'><dt id='ONuiN'><q id='ONuiN'><span id='ONuiN'><b id='ONuiN'><form id='ONuiN'><ins id='ONuiN'></ins><ul id='ONuiN'></ul><sub id='ONuiN'></sub></form><legend id='ONuiN'></legend><bdo id='ONuiN'><pre id='ONuiN'><center id='ONuiN'></center></pre></bdo></b><th id='ONuiN'></th></span></q></dt></tr></i><div id='ONuiN'><tfoot id='ONuiN'></tfoot><dl id='ONuiN'><fieldset id='ONuiN'></fieldset></dl></div>

  1. <tfoot id='ONuiN'></tfoot>
  2. <legend id='ONuiN'><style id='ONuiN'><dir id='ONuiN'><q id='ONuiN'></q></dir></style></legend>

    • <bdo id='ONuiN'></bdo><ul id='ONuiN'></ul>

      <small id='ONuiN'></small><noframes id='ONuiN'>

    1. C++ 类/结构成员的默认可见性

      default visibility of C++ class/struct members(C++ 类/结构成员的默认可见性)
      • <legend id='Eirnp'><style id='Eirnp'><dir id='Eirnp'><q id='Eirnp'></q></dir></style></legend>

        1. <i id='Eirnp'><tr id='Eirnp'><dt id='Eirnp'><q id='Eirnp'><span id='Eirnp'><b id='Eirnp'><form id='Eirnp'><ins id='Eirnp'></ins><ul id='Eirnp'></ul><sub id='Eirnp'></sub></form><legend id='Eirnp'></legend><bdo id='Eirnp'><pre id='Eirnp'><center id='Eirnp'></center></pre></bdo></b><th id='Eirnp'></th></span></q></dt></tr></i><div id='Eirnp'><tfoot id='Eirnp'></tfoot><dl id='Eirnp'><fieldset id='Eirnp'></fieldset></dl></div>
        2. <small id='Eirnp'></small><noframes id='Eirnp'>

            • <bdo id='Eirnp'></bdo><ul id='Eirnp'></ul>
                <tbody id='Eirnp'></tbody>

                <tfoot id='Eirnp'></tfoot>

              1. 本文介绍了C++ 类/结构成员的默认可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 C++ 中,为什么类成员的默认可见性是私有的,而结构是公共的?

                In C++, why is private the default visibility for members of classes, but public for structs?

                推荐答案

                C++ 是作为 C 的超集引入的.结构是从 C 继承而来的,其成员的语义是公共的.存在大量 C 代码,包括希望与 C++ 一起使用的库,它们使用结构.类是在 C++ 中引入的,为了符合 OO 的封装哲学,它们的成员默认是私有的.

                C++ was introduced as a superset of C. Structs were carried over from C, where the semantics of their members was that of public. A whole lot of C code exists, including libraries that were desired to work with C++ as well, that use structs. Classes were introduced in C++, and to conform with the OO philosophy of encapsulation, their members are private by default.

                这篇关于C++ 类/结构成员的默认可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to print vector#39;s data(如何打印矢量的数据)
                Visual C++ appends 0xCC (int3) bytes at the end of functions(Visual C++ 在函数末尾附加 0xCC (int3) 字节)
                How to use a variable inside a _T wrapper?(如何在 _T 包装器中使用变量?)
                MSVC++ warning flags(MSVC++ 警告标志)
                How to read file which contains uxxxx in vc++(如何在vc++中读取包含uxxxx的文件)
                stack overflow error in C++ program(C++程序中的堆栈溢出错误)
              2. <small id='oOWQe'></small><noframes id='oOWQe'>

                  <legend id='oOWQe'><style id='oOWQe'><dir id='oOWQe'><q id='oOWQe'></q></dir></style></legend><tfoot id='oOWQe'></tfoot>

                    <i id='oOWQe'><tr id='oOWQe'><dt id='oOWQe'><q id='oOWQe'><span id='oOWQe'><b id='oOWQe'><form id='oOWQe'><ins id='oOWQe'></ins><ul id='oOWQe'></ul><sub id='oOWQe'></sub></form><legend id='oOWQe'></legend><bdo id='oOWQe'><pre id='oOWQe'><center id='oOWQe'></center></pre></bdo></b><th id='oOWQe'></th></span></q></dt></tr></i><div id='oOWQe'><tfoot id='oOWQe'></tfoot><dl id='oOWQe'><fieldset id='oOWQe'></fieldset></dl></div>

                      <tbody id='oOWQe'></tbody>

                      • <bdo id='oOWQe'></bdo><ul id='oOWQe'></ul>