View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp2000 Midterm Review: Definitions

Review at Midterm Review - Sp2000.

(a) Inheritance is implicitly passing information from one program component to another. Inheritance is ethe recieving of properties or characteristics of another component acording to a special relatoinship that exists between the components.

(b) Delegation is forcing a class to implement something. This is usually done through inheritance. (i'm kind of lost on this one HELP PLEASE)

(c) Polymorphism is the ability of a single operator or subprogram name to refer to any number of function definitions depending on the data types.

Michael Emard

(c) is closest. (a) is trying to be too general. (b) is well... Another try, perhaps? Mark Guzdial


a) Inheritance is the superclass/subclass relationship. A super class is the most general class that defines attributes and methods that its children all inherit from it. The subclasses are the more specific classes. The favorite example is from 1502: Animal is the super class (which of course is a subclass of Object). All animals can do things like eat, sleep, and makeNoise, and they can all have names. Subclasses of Animal include Cat, Dog, and Human. Each of these specific animals can eat, sleep, and makeNoise, but the makeNoise method is different for each one. There can also be new methods in these classes for actions and attributes specific to that kind of animal.

Is this closer to what you wanted?
Susi

Nice! Mark Guzdial

a) Inheritance is when a class is declared as a subclass of another 'parent' class. This subclass will inherit everything that the parent class has, or- be able to implement all of the actions and know everything that the parent knows.

b) Delegation is when one object does not or cannot perform an aciton, but instead defers this action to a different obbject to be completed- 'defering' this action to someplace else.

c) Polymorphism is the ability of an object to be able to handle or perform actions on multpiple types of something.

Shaun Morber
EEKS, NO! In O-O systems, objects don't act on types! Delegation is okay. Mark Guzdial

C) polymorphism is the net effect of inheritence and delegation. example: if I write a class Animal (which is abstract unless you are talking about muppets) and Animals know how to makeNoise, eat, move etc. Then using polymorphism I can interface with an Animal without worrying about the fact I will never get an instance of Animal but may be getting a dog a cat or an animalMuppet. I can say myAnimal eat without knowing what myAnimal is or what it eats. I can say myAnimal makeNoise and a dog will bark while a cat meows. My ability to ignore what an object really is and treat it like a super class object. That is polymorphism.
Kwash
Polymorphism is actually due to late-binding and has nothing directly to do with delegation nor inheritance. You can only have polymorphism if you decide at run-time what code implements a message. The lookup at run-time can happen through delegation or inheritance. Mark Guzdial

c) Something is polymorphic if it can be transparently used on
instances of different types. For example, we could have a group
of classes representing different shapes: rectangles, ovals, triangles. Each shape knows how to draw itself and calculate its area. Every shape would do this differently, but they would all
share these abilities. Polymorphism allows us to write code in
terms of a generic shape type and have it work correctly for the
actual shape.
Nice! Mark Guzdial

Link to this Page