inheritanceQuestions

inheritanceQuestions - 2009 November 23 Inheritance Example...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
2009 November 23 Inheritance Example Test Questions 1. Give and explain the type rule with genericity using an example method call. 2. Assume class A inherits from class B. Are the invariants of B also invariants of A? How about creation routines of B? Justify both your answers. 3. A class B can depend on a class A based on either inheritance or client-supplier relationship. There are cases where both the client-supplier and inheritance relationships seem appropriate. However, the Rule of Change and the Rule of Polymorphism favour one over the other. Explain under what circumstances you would choose a client-supplier relationship. Which rule is used to support your decision? Explain under what circumstances you would choose an inheritance relationship. Which rule is used to support your decision? 4. Describe constraint genericity. How is such genericity related to inheritance? Provide an example where constraint genericity is useful. 5. When you redefine a feature, you can redefine the signature and body independently. Explain why you need redefinition of each part and what are the constraints on redefinition. 6. When you redefine a feature, there are two parts of a feature you can redefine independently. Explain what they are, why you need redefinition of each part and what are the constraints on redefinition? 7. What is the rule of change in the context of deciding between use and inheritance? Give three natural language definitions and their corresponding Eiffel class definitions that illustrate the choices in deciding between use and inheritance? 8. When using multiple inheritance sharing and replication of attributes are the choices that are available. Using a BON diagram, give an example where sharing is not an option. Explain why sharing is not an option. 9. When using multiple inheritance sharing and replication of attributes are the choices that are available. Using a BON diagram, give an example where sharing and replication are options. Explain why sharing is an option and how you get sharing. Explain why replication is an option and how you get replication. 10. When using multiple inheritance some features may be joined. Using a BON diagram, give an example where join is an option and explain under what conditions join is possible.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2009 November 23 Inheritance Example Test Questions Page 2 of 10 11. Explain what happens to the export status of inherited features in an heir. 12. Why would you not normally build the QUEUE class from the ARRAY class using inheritance? 13. In Eiffel, inherited functions can be redefined as attributes but not vice versa. Why not? 14. Consider the following inheritance diagram. What problems can arise and how can they resolved? You are not required to solve all problems simultaneously, just describe the various problems and their
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 10

inheritanceQuestions - 2009 November 23 Inheritance Example...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online