I came from a highly functional and procedural background in programming, and never knew that a type is the same as an interface.
As in the Design Patterns book by GoF, it says:
A type is a name used to denote a particular interface. We speak of an object as having the type "Window" if it accepts all requests for the operations defined in the interface named "Window." An object may have many types, and widely different objects can share a type. (p. 13)
The surprising thing is, I thought of type as char (like a character, or 1 byte), or int (a word, or 4 bytes or 8 bytes), or a pointer to character (a string in C language) before. Maybe even a struct with x and y as coordinate of a point, or an array, as a type, but I never thought of a type being "an interface".
So it looks like a Car object can be of the type Moveable and Soundable, and a Dog object can be of the type Moveable and Soundable, while a Circle object may be of the type Moveable only, until we decide that a Shape object also need to give out sound, when a user clicks on it, and we let the Shape class implement the Soundable interface and now a Circle object is also of the type Soundable?
I wonder when and how it happened? Is it actually said to be so by the GoF book for the first time in 1994 when the book got published? Or is it actually existing idea that came from long time ago?
It actually sound exactly the same as Duck Typing, but Duck Typing seems like a new concept that began about in 2003 in the Python and Ruby community, not like an idea that was in 1994 or earlier.