CSE 2221 Exam Study Guide | Study Questions with 100% Correct Verified Answers
The Implements Relation - ANSWER The implements relation may hold between a class and an interface. If C implements I then class C contains code for the behavior specified in interface I. This means that C has method bodies for instance methods whose contracts are specified in I. The code of C looks like this: class C implements I { // bodies for methods specified in I } The implements relation allows you to separate contracts from their implementations- a best practice for component design. The Extends Relation - ANSWER The extends relation may hold between: 2 interfaces or 2 classes. If B extends A then B inherits all the methods of A. This means B implicitly starts out with all the method contracts (for an interface) or all the method bodies (for a class) that A has. B can then add more method contracts (for an interface) or method bodies (for a class).
Written for
- Institution
- CSE 2221
- Course
- CSE 2221
Document information
- Uploaded on
- May 25, 2024
- Number of pages
- 14
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
Also available in package deal