Question:
Indicate which occurrences of the following inheritance relationships are specification inheritance and which are implementation inheritance.
Answer:
Guide:
A) Implementation inheritance refers to the use of inheritance for the sole purpose of reusing code. Developers reuse code quickly by sub classing an existing class and refining tis behavior. Implementation inheritance represent refuse among conceptually unrelated classes.
B) Specification inheritance refers to inheritance used as a means of subtyping. The classification of concept into type hierarchies is called specification inheritance (also called interface inheritance’)
Indicate which occurrences of the following inheritance relationships are specification inheritance and which are implementation inheritance.
Answer:
- A Rectangle class inherits from a Triangle class (Implementation inheritance)
- A Vector class inherits from an Array class (Implementation inheritance)
- A Circle class inherits from a Sphere class (specification inheritance)
- A Arc class inherits from a Circle class (Implementation inheritance)
- A Student class inherits from a Person class (specification inheritance)
Guide:
A) Implementation inheritance refers to the use of inheritance for the sole purpose of reusing code. Developers reuse code quickly by sub classing an existing class and refining tis behavior. Implementation inheritance represent refuse among conceptually unrelated classes.
B) Specification inheritance refers to inheritance used as a means of subtyping. The classification of concept into type hierarchies is called specification inheritance (also called interface inheritance’)
0 comments:
Post a Comment