joojooga
03-14-2003, 10:48 PM
First, WROX's definition of a class..
As we have seen, a class is a data type that you define to suit your own application requirements. Classes in object-oriented programming also define the objects to which your program relates. You program the solution to a problem in terms of the objects that are specific to the problem, using operations that work directly with those objects. You can define a class to represent something abstract, such as a complex number, which is a mathematical concept, or a truck, which is decidedly physical (especially if you run into one on the highway). So, as well as being a data type, a class can also be a definition of a real-world object, at least to the degree necessary to solve a given problem.
You can think of a class as defining the characteristics of a particular group of things that are specified by a common set of parameters and share a common set of operations that may be performed on them. The operations that are possible are defined by the class interface contained in the public section of the class definition. The Box class that we used in the last chapter is a good example - it defined a box in the most elementary terms.
Of course, in the real world there are many different kinds of box: there are cartons, coffins, candy boxes and cereal boxes, and you will certainly be able to come up with many others. You can differentiate boxes by the kinds of things they hold, the materials they are made of, and in a multitude of other ways, but even though there are many different kinds of box, they share some common characteristics - the essence of boxiness perhaps - and, therefore, you can still visualize them as actually being related to one another, even though they have many differentiating features. You could define a particular kind of box as having the generic characteristics of all boxes - perhaps just a length, a breadth and a height - plus some additional parameters which serve to differentiate your kind of box from the rest. You may also find that there are new things you can do with your particular kind of box that you can't do with other boxes......
Anyway, I've been working C++ for a little bit now and I'm getting into classes. In terms of everquest mobs, would you agree that based on that definition that EQ Mobs are classes and their capabilities and behaviours are public functions of their class? Nerdy I know, but I think its kinda cool..
As we have seen, a class is a data type that you define to suit your own application requirements. Classes in object-oriented programming also define the objects to which your program relates. You program the solution to a problem in terms of the objects that are specific to the problem, using operations that work directly with those objects. You can define a class to represent something abstract, such as a complex number, which is a mathematical concept, or a truck, which is decidedly physical (especially if you run into one on the highway). So, as well as being a data type, a class can also be a definition of a real-world object, at least to the degree necessary to solve a given problem.
You can think of a class as defining the characteristics of a particular group of things that are specified by a common set of parameters and share a common set of operations that may be performed on them. The operations that are possible are defined by the class interface contained in the public section of the class definition. The Box class that we used in the last chapter is a good example - it defined a box in the most elementary terms.
Of course, in the real world there are many different kinds of box: there are cartons, coffins, candy boxes and cereal boxes, and you will certainly be able to come up with many others. You can differentiate boxes by the kinds of things they hold, the materials they are made of, and in a multitude of other ways, but even though there are many different kinds of box, they share some common characteristics - the essence of boxiness perhaps - and, therefore, you can still visualize them as actually being related to one another, even though they have many differentiating features. You could define a particular kind of box as having the generic characteristics of all boxes - perhaps just a length, a breadth and a height - plus some additional parameters which serve to differentiate your kind of box from the rest. You may also find that there are new things you can do with your particular kind of box that you can't do with other boxes......
Anyway, I've been working C++ for a little bit now and I'm getting into classes. In terms of everquest mobs, would you agree that based on that definition that EQ Mobs are classes and their capabilities and behaviours are public functions of their class? Nerdy I know, but I think its kinda cool..