关于c ++:类和结构之间的区别

difference between classes and structure

本问题已经有最佳答案,请猛点这里访问。

我知道类和结构的主要区别在于类是引用类型,结构是值类型。有人能解释一下值类型和引用类型是什么意思吗?


(P)你必须考虑一种不同的语言。In C+,class types are seminally the same whether you introduce them with the EDOCX1 original 0 or EDOCX1.它们是目标类型(其中一种可能被称为"价值类型"),在目标与价值代表的感觉中。(p)(P)The only difference is that base classes and members are public by default if you use original EDOCX1,and private if you use original EDOCX1.(p)(P)Reference types are denoted with EDOCX1 penographic 14 universal or EDOCX1 reunifical 15,and can refer to any object or function type,not just classes.(p)


(P)The only difference between EDOCX1 penal 0 is and EDOCX1 welcx1 is that by default members/bases are EDOCX1 big 2 to a EDOCX1 welcx1/welcx1 welcx1(p)(P)Now values and references are totally orthognal concepts in C++to EDOCX1 universal 0/EDOCX1 commercial 1,basically meaning instance of a EDOCX1 universal 0/EDOCX1 universal 1 and handle-to-instance.(p)


(P)In C+,the only differences between a structure and a class is the default member access and default inheritance:(p)字母名称(P)然而,我通常要在这些目标之间作出区分:我使用一个结构来表示,我的目标确实是在没有任何方法(其他事项的解决者和使用者)的情况下收集数据的会员国(那些有公开机会的会员国)。(p)