And that's it for our introduction to using Object Oriented (OO) design techniques. We've looked at inheritance, multiple inheritance and polymorphism, and you can see how designing the class tree structure in this way forces the designer to fully understand the problem. It also defines very … [Read more...]
Object Oriented Programming – Examples
Earlier we developed a class inheritance tree for some game characters in a maze game, but we need to design another class, or class hierarchy, for the maze. Since we want the mazes to have different levels of difficulty, each level of maze will require slightly different functions. We can … [Read more...]
Object Oriented Programming 6
Now that we know what a class is, and how to derive classes using inheritance, we'll take a quick look at the slightly thorny issue of multiple inheritance. In the simplest terms, this is when a derived class has more than one base class. Theoretically a class may derive from any number of base … [Read more...]
Object Oriented Programming 5
To illustrate putting together an object oriented (OO) class hierarchy design, let's take a look at a simple maze game. We'll be creating an OO design, but we're not going to select a programming language at this stage. We'll see how we can analyse the problem from an OO perspective, and produce … [Read more...]
Object Oriented Programming 4
In object oriented (OO) programming, class inheritance is the process of deriving new classes from existing classes. It's a technique that was developed, at least in part, to enable the better reuse of existing code, but it can have its downsides too. It can lead to complications in the design … [Read more...]
Object Oriented Programming 3
Encapsulation From what we've covered so far we can suggest that: A class is an abstract data type made up of a combination of the relevant data and associated methods. Each class not only has specific data members, it also has it's member functions or methods. The methods are the tasks … [Read more...]
Object Oriented Programming 2
Imagine creating a blueprint for an intelligent robot. The robot's purpose is very simple: to open the curtains in the morning, and to close them at night. You call them CurtainBots, build three of them, and install them in your home. Great... Now, if you consider the blueprint as a … [Read more...]