Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 4 by Michael Gorbsky
Discussion 4: Answer a Midterm Review Question.
Define each and give an example.
a. What is Inheritance?
It is the use of classes that aquire the attributes and functions of the class from which it extends. Class Animal has the function called breath, which is something all animals are required to do. Class Dog extends Animal, thus the function breath can be called from within Dog since it is defined in Animal.
b. What is Delegation?
It is when a class, instead of performing a job, passes it on (or "delegates" it) to another class. Two classes Concious and Subconcious exist. The concious mind does not need to handle mundane tasks like breathing. So it passes the job of breathing to Subconcious.
c. What is Polymorphism?
It means having many different classes that implement the same superclass. For instance, Bird, Fish, and Dog are all Animals. Although they are very different types of Animals, all of them still extend Animal.
Links to this Page
- Michael Gorbsky last edited on 9 December 2005 at 8:05 am by lawn-199-77-214-24.lawn.gatech.edu
- Fall 2005 Discussion 4 last edited on 6 December 2005 at 3:45 pm by r36h51.res.gatech.edu