I’m confused about why classes are considered data types.
I understand that part of them is “data”, and the other part is the methods. Why are they called data types?
Procedures in procedural programming languages, like C, hold one or more fundamental data types, sometimes. But they are not called data types.
Given the definition at Wikipedia:
I believe classes fit the definition quite well, while procedures in procedural programming like C don’t fit at all.
Classes represent a set of possible values (objects) and defines the possible operations that can be done on the values of this type. It also makes it clear how to represent objects of the class in memory.
Procedures in C however does not identify a set of possible values and it wouldn’t make sense to say that there are definitions stating what operations can be performed on procedures.
Perhaps your confusion stems from some text on functional programming where a procedure (or function) is treated as a first class value which has a specific type.