【文件属性】:
文件名称:C#结构体特性及与类的区别
文件大小:3KB
文件格式:TXT
更新时间:2015-10-01 03:41:08
结构体 类 C#
结构体的定义:
结构体也可以象类一样可以单独定义.
class a{};
struct a{};
结构体也可以在名字前面加入控制访问符.
public struct student{};
internal struct student{};
如果结构体student没有publice或者internal的声明 类program就无法使用student结构定义 obj对象
如果结构体student的元素没有public的声明,对象obj就无法调用元素x
因为默认的结构体名和元素名是*******类型
程序: