In programming language theory, a type is a set of values. E.g. the type "int" is the set of all integer values.
In OOP languages, a class is a type, is it?
When a class is defined with more than one members, e.g.
class myclass{
int a;
double b;
}
When we talk about a class, do we mean
- "
(a,b)whereais an int andbis a double", or - "{
(x,y)|xis any int,yis any double}"?
What does an instance of myclass mean?
- "
(a,b)whereais an int andbis a double", or - an object which occupies a memory space and which can (not necessarily, i.e. can be empty) store
(x,y), wherexis any int andyis any double?
Aucun commentaire:
Enregistrer un commentaire