What is "class" in OOP? How does it relaters to reality? How to use it?
Name:
Anonymous2011-07-30 1:34
Classes help you define a hierarchy amongst your objects, and they show what kind of role each object will occupy and what tasks it performs.
For instance, you can define your view class like this: class CarController :Bourgeoisie {
...
},
and your model class like this: class CarModel :Proletariat {
...
}
To show that CarControllers use and exploit the CarModels without producing anything themselves.
We can also define: class CarView :Aristocracy {
...
},
which signifies that the CarViews live large on the backs of both the CarControllers and CarModels while they stand and watch them do the real work, by privilege of birth. Incidentally, the CarViews will be the first against the wall when the revolution comes.