Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 4 Kalpit Patel
Question From Spring2004 Midterm Review
Define each and give an example.
What is Inheritance?
What is Delegation?
What is Polymorphism?
What is Encapsulation?
What is the MVC paradigm? (For an example show an example using MVC)
Inheritance allows one class to implicitly have all of the properties
(methods and variables) of a parent class. The "child class" can override
these methods to specify new behavior, or can add completely new methods
that were not present at all in the parent class. http://java.sun.com/docs/books/tutorial/java/concepts/inheritance.html
The activity of asking another object to perform a service for the original object receiving the message, is called delegation http://en.wikipedia.org/wiki/Delegation_(computer_science)
Polymorphism is the property by which an instance of a subclass may be
treated as an instance of its parent class.
if we declare
a variable or parameter whose type is class Animal, and we have an instance
of Cat (where Cat is a subclass of Animal), we may freely assign that cat
to the variable, or pass it as the parameter whose types are Animal:
Cat c= new Cat();
Animal a=c; // this is ok
methodThatTakesAnAnimal(c); // parameter type is Animal- this is ok,
// because a Cat is-an Animal
the concept that objects have their own data and behaviors, and that no other object can access the data without a given object's permission. http://en.wikipedia.org/wiki/Information_hiding
The MVC paradigm:
The MVC paradigm of GUIs says that when designing a GUI, one should separate
the model (that part that has the data and does the calculations),
the view (the part that the user sees), and the controller (the part
that the user interacts with) into three distinct and easily seperable parts.
Links to this Page