What is the difference between Type and Class?

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

What makes a type different from class and vice versa?

(In the general language-agnostic sense)

20条回答
  •  盖世英雄少女心
    2020-11-28 01:24

    To illustrate it the fastest way:

    A Struct is a Type, but a Struct is not a Class.

    As you can see, a Type is an "abstract" term for not only definitions of classes, but also structs and primitive data types like float, int, bool.

提交回复
热议问题