转:struct和class区别小结
来源:互联网 发布:重庆seo基础入门 编辑:程序博客网 时间:2024/05/17 07:28
A struct is similar to a class, with the following major differences:
A class is a reference type, while a struct is a value type. Consequently, structs are typically used to express simple types, in which value-type semantics are desirable (e.g., assignment copies a value rather than a reference).
A class fully supports inheritance , whereas a struct can inherit only from an object and is implicitly sealed (in the runtime structs actually inherit from System.ValueType). Both classes and structs can implement interfaces.
A class can have a destructor, and a struct cannot.
A class can define a custom parameterless constructor and initialize instance fields, while a struct cannot. The default parameterless constructor for a struct initializes each field with a default value (effectively zero). If a struct declares a constructor(s), then all of its fields must be assigned in that constructor call.
结构具有以下特点:
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/changesway/archive/2008/10/28/3165141.aspx
- 转:struct和class区别小结
- struct和class区别小结
- struct和 class区别
- class和struct区别
- struct和class 区别
- struct和class 区别
- class和struct区别
- struct和class的区别(转)
- class和struct有什么区别?[转]
- struct和class的区别
- struct和class的区别- -
- struct和class的区别
- class和struct的区别
- struct和class的区别
- struct和class的区别
- class 和 struct 的区别
- Struct 和 Class 的区别
- class和struct的区别
- 我怎么连好友也加不上五个哟
- 这是我的第一篇笔记
- 求1到20的阶乘的和
- 大家好 初来乍到,请多关照
- 领略人生
- 转:struct和class区别小结
- 学习之惑
- [10月9日]LAMP兄弟连免费线下讲座——职业技能讲座(李明老师主讲)
- TCP关闭等待时间和最大可用端口数
- shell的一些快捷键(不完整版,哈哈)
- 第四章 控制执行流程
- 求职中的平常心——Leo网上答疑48
- 8-3编程器
- 添加动画(Animate控件)