★★创造未来★★

Only Creation Can Develop The World!

18. Structs

Structs are similar to classes in that they represent data structures that
can contain data members and
function members. However, unlike classes, structs are value types and do
not require heap allocation. A
variable of a struct type directly contains the data of the struct, whereas
a variable of a class type contains a
reference to the data, the latter known as an object.
[Note: Structs are particularly useful for small data structures that have
value semantics. Complex numbers,
points in a coordinate system, or key-value pairs in a dictionary are all
good examples of structs. Key to
these data structures is that they have few data members, that they do not
require use of inheritance or
referential identity, and that they can be conveniently implemented using
value semantics where assignment
copies the value instead of the reference. end note]
As described in §11.1.3, the simple types provided by C#, such as int,
double, and bool, are, in fact, all
struct types. Just as these predefined types are structs, it is also
possible to use structs and operator
overloading to implement new ?primitive? types in the C# language. Two
examples of such types are given
at the end of this chapter (§18.4).
阅读更多
个人分类: c#/c++
上一篇17.12 Destructors
下一篇18.1 Struct declarations
想对作者说点什么? 我来说一句

Structs学习Structs学习Structs学习

2008年06月19日 2KB 下载

精通structs.pdf

2011年08月08日 19.28MB 下载

structs实例(structs实例)

2009年02月24日 10.86MB 下载

基于structs的图书管理系统

2012年01月05日 3.34MB 下载

经典Structs教程

2009年08月11日 698KB 下载

string Hibernate structs教程

2010年09月08日 1.01MB 下载

struts

2007年08月20日 3.15MB 下载

structs原理与实践

2007年07月05日 509KB 下载

Structs培训.doc

2008年03月13日 49KB 下载

没有更多推荐了,返回首页

关闭
关闭