What is the difference between Type and Class?

前端 未结 20 2305
梦谈多话
梦谈多话 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:12

    I always think of a 'type' as an umbrella term for 'classes' and 'primitives'.

    int foo; // Type is int, class is nonexistent.

    MyClass foo; // Type is MyClass, class is MyClass

提交回复
热议问题