是什么类和数据类型之间的区别? [英] What is the difference between a class and a datatype?

查看:191
本文介绍了是什么类和数据类型之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经听到了下面的语句:




我们可以说类是数据类型或数据类型是一种类




任何人都可以向我解释,究竟是什么意思吗?


解决方案

C#是一种强类型语言;
,因此每一个变量和对象的
必须有一个声明的类型。




的数据类型可以是描述为两种:




一个内置的数据类型,如int
或char或



一个用户定义的数据类型,如
类或接口。



中的数据类型也可以被定义为
情况之一:



值类型(C#参考),其中
存储值,或



引用类型(C#参考),其中
引用存储的实际数据。




**类是用户定义的数据类型。
**


I have heard the following statement:

We can say class is a datatype or a datatype is one type of class.

Can anyone explain to me what exactly this means?

解决方案

C# is a strongly typed language; therefore every variable and object must have a declared type.

A data type can be described as being either:

A built-in data type, such as an int or char, or

A user-defined data type, such as a class or interface.

Data types can also be defined as being either:

Value Types (C# Reference), which store values, or

Reference Types (C# Reference), which store references to the actual data.

** Class is a user define data type. **

这篇关于是什么类和数据类型之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆