What is the difference between a class and a datatype?

前端 未结 10 1125
广开言路
广开言路 2021-02-13 15:30

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 wh

10条回答
  •  一个人的身影
    2021-02-13 15:49

    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. **

提交回复
热议问题