CSC/ECE 517 Fall 2007/wiki2 9 cv: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
Inheritance is a way to form new classes in object oriented programming using already defined classes. Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. | Inheritance is a way to form new classes in object oriented programming using already defined classes. Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program. | ||
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding. | |||
== <b> References </b> == | == <b> References </b> == | ||
[http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation] | [http://users.encs.concordia.ca/~hshong/comp6471/ch5-2.ppt Inheritance vs. Delegation] |
Revision as of 02:33, 23 October 2007
Inheritance vs. delegation. Follow the debate on inheritance vs. delegation. Construct (or, better, cite) examples that show cases where inheritance is better, and cases where delegation is better. Attempt to characterize the situations in which you should employ one or the other.
Inheritance vs. Delegation
Inheritance is a way to form new classes in object oriented programming using already defined classes. Inheritance is used to help reuse code that already exists with little or no modifications and this is one of the advantages of using inheritance since it helps reduce the complexity of a program.
Delegation is when one object relies on another object in order to provide a specified set of functionalities and this is sometimes referred to as aggregation, consultation, or forwarding.