Solution 1:

The following answer is from Gof book (Design Patterns)

An object's class defines how the object is implemented. The class defines object's internal state and the implementation of its operations.

In contrast, an object's type only refers to its interface - a set of requests to which it can respond.

An object can have many types, and objects of different classes can have the same type.

//example in c++
template<typename T> 
const T & max(T const &a,T const &b)
{
return a>b?a:b;  //> operator of the type is used for comparison
}

max function requires a type with operation > with its own type as one of it interface any class that satisfies the above requirement can be used to generate specific max<particular class/primitive type> function for that class.

Solution 2:

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

Solution 3:

Inspired by Wikipedia...

In type theory terms;

  • A type is an abstract interface.
    Types generally represent nouns, such as a person, place or thing, or something nominalized,

  • A class represents an implementation of the type.
    It is a concrete data structure and collection of subroutines

    Different concrete classes can produce objects of the same abstract type (depending on type system).

    *For example, one might implement the type Stack with two classes: SmallStack (fast for small stacks, but scales poorly) and ScalableStack (scales well but high overhead for small stacks).*

    Similarly, a given class may have several different constructors.

enter image description here

The banana example.

  • A Banana type would represent the properties and functionality of bananas in general.

  • The ABCBanana and XYZBanana classes would represent ways of producing bananas.
    (Different banana suppliers in real life, or different data structures and functions to represent and draw bananas in a video game).

    The ABCBanana class could then produce particular bananas which are instances of the ABCBanana class, they would be objects of type Banana.

It is not rare the programmer provide a single and only implementation for a type. In this case the class name is often identical with the type name. But there is still a type (which could be extracted in an interface if required), and an implementation (which would implement the separate interface) which builds instances (objects) of the class.

Solution 4:

Type is the umbrella term for all the available object templates or concepts. A class is one such object template. So is the structure type, the Integer type, the Interface type etc. These are all types

If you want, you can look at it this way: A type is the parent concept. All the other concepts: Class, Interface, Structure, Integer etc inherit from this concept.i.e They are types