18. Structs

原创 2006年05月25日 05:40:00
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).

相关文章推荐

(06)Structs初学笔记——result_type

先写两个概念: forward(转发):     1、forward是服务器跳转,浏览器不知道它所请求的具体资源来源,浏览器的地址栏不会变;     2、request.getRequest...

Structs2中的参数传递方式以及对Web对象(request,session,application)的操作

在servlet中,我们以request.getParater("")方式去传递获取参数,那么在Structs2中是传递的参数的方式大体上有3中: 1:简单类型参数的传递eg:int,String等...

Golang初级系列教程-结构体匿名字段-Anonymous fields in structs

Golang初级系列教程-结构体匿名字段-Anonymous fields in structsGo 结构体中支持匿名字段。1.外围结构体可以直接访问匿名结构体的字段 2.匿名字段通过其类型名也可以访...

【web开发学习笔记】Structs2 Action学习笔记(一)

1、org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter准备和执行 2、 struts2 ...

structs2工作原理

在学习struts2之前,首先我们要明白使用struts2的目的是什么?它能给我们带来什么样的好处? 设计目标     Struts设计的第一目标就是使MVC模式应用于web程序设计。在这儿M...

运用structs+Hibernate建立网页分页效果

学习 MyEclipse6 Java开发中文教程 1、建立new web project 2、add Hibernate capability 3、向导建立hibernate配置文件...

Structs2入门篇(环境搭建及Demo)

Structs2入门篇(环境搭建及Demo)

structs2 工作原理

Struts2的工作原理   上图来源于Struts2官方站点,是Struts 2 的整体结构。 一个请求在Struts2框架中的处理大概分为以下几个步骤 1 客户端初始化一个指向...

java Structs 介绍

转自: http://www.2cto.com/kf/201209/158216.html 说明: 代码没有做过验证 Structs是Java三大框架之一,Struts是采用Ja...

Structs接收参数的三种方式Model,ModelDriver

Structs接收参数 使用Action的属性接收参数 使用DomaimModel接收参数 使用ModelDriver接收参数...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:18. Structs
举报原因:
原因补充:

(最多只允许输入30个字)