Ipower web hosting - Chapter 1: All About Java 19 instructions for
Chapter 1: All About Java 19 instructions for building bedrooms. To make things worse, the instructions could be scattered among pages 234, 394 410, 739, 10, and 2. If the builder had to decipher other peoples complicated instructions, the task would be ten times harder. Starting with a class, however, is like starting with a blueprint. If you decide to have both three- and four-bedroom houses, you can start with a blueprint called the house blueprint that has a ground floor and a second floor, but has no indoor walls drawn on the second floor. Then, you make two more second- floor blueprints one for the three-bedroom house and another for the four- bedroom house. (You name these new blueprints the three-bedroom house blueprint and the four-bedroom house blueprint.) Your builder colleagues are amazed with your sense of logic and organization, but they have concerns. They pose a question. You called one of the blueprints the three-bedroom house blueprint. How can you do this if it s a blueprint for a second floor and not for a whole house? You smile knowingly and answer, The three-bedroom house blueprint can say, For info about the lower floors, see the original house blueprint. That way, the three-bedroom house blueprint describes a whole house. The four- bedroom house blueprint can say the same thing. With this setup, we can take advantage of all the work we already did to create the original house blueprint and save lots of money. In the language of object-oriented programming, the three- and four-bedroom house classes are inheriting the features of the original house class. You can also say that the three- and four-bedroom house classes are extending the original house class. (See Figure 1-1.) The original house class is called the superclass of the three- and four-bedroom house classes. In that vein, the three- and four-bedroom house classes are subclasses of the original house class. Put another way, the original house class is called the parent class of three- and four-bedroom house classes. The three- and four-bedroom house classes are child classes of the original house class. (See Figure 1-1.) Needless to say, your home-builder colleagues are jealous. A crowd of home- builders is mobbing around you to hear about your great ideas. So, at that moment, you drop one more bombshell: By creating a class with subclasses, we can reuse the blueprint in the future. If someone comes along and wants a five-bedroom house, we can extend our original house blueprint by making a five-bedroom house blueprint. We ll never have to spend money for an original house blueprint again. But, says a colleague in the back row, what happens if someone wants a different first-floor design? Do we trash the original house blueprint or start scribbling all over the original blueprint? That ll cost big bucks, won t it?
Our unmatched NT experience allows us to provide the most reliable and affordable hosting for our customers, just check NT Web Hosting services.