What is the difference between Type and Class?

前端 未结 20 2368
梦谈多话
梦谈多话 2020-11-28 01:00

What makes a type different from class and vice versa?

(In the general language-agnostic sense)

20条回答
  •  旧时难觅i
    2020-11-28 01:15

    Type is conceptually a superset of class. In the broader sense, a class is one form of type.

    Closely related to classes are interfaces, which can bee seen as a very special kind of class - a purely abstract one. These too are types.

    So "type" encompasses classes, interfaces and in most languages primitives too. Also platforms like the dot-net CLR have structure types too.

提交回复
热议问题