Team LiB
Previous Section Next Section

Exercises

  1. Test yourself: run through the following list of OO terms—some formal, some informal—and see if you can define each in your own words without referring back to the text:

    • Abstract class

    • Abstract method

    • Abstraction

    • Accessor (of a property)

    • Accessor method

    • Aggregation

    • Ancestor class

    • Association

    • Attribute

    • Base class

    • Behavioral relationship

    • Binary association

    • Class

    • Class hierarchy

    • Class variable

    • Classification

    • Client (object)

    • Client code

    • Collection class

    • Composite class

    • Constant

    • Constructor

    • Delegation

    • Derived class

    • Dictionary

    • Encapsulation

    • Feature

    • Field

    • Generalization

    • get accessor

    • "Get" method

    • Getter

    • Handle

    • Information hiding

    • Inheritance

    • Instance

    • Instance variable

    • Instantiation

    • Interface

    • Local variable

    • Leaf node

    • Link

    • Member

    • Message

    • Method

    • Method header

    • Method signature

    • Modeling

    • Multiple inheritance

    • Multiplicity

    • Object (in the software sense)

    • Operation

    • Ordered list

    • Overloading

    • Overriding

    • Parent class

    • Polymorphism

    • Predefined type

    • Private accessibility

    • Public accessibility

    • Reference

    • Reference variable

    • Reflexive association

    • Root (of a class hierarchy)

    • Service

    • Set (as a collection type)

    • set accessor

    • "Set" method

    • Setter

    • Sibling class

    • Simple type

    • Sorted ordered list

    • Specialization

    • State

    • Static attribute

    • Static method

    • Static variable

    • Structural relationship

    • Supplier (object)

    • Unary association

    • User-defined type

  2. Which attributes, belonging to which SRS classes, might be well suited to being declared as static?

  3. Which attributes, belonging to which Prescription Tracking System classes (as described in Appendix B), might be well suited to being declared as static?

  4. It has been argued that the ability to declare and implement interfaces in the C# language eliminates the need for multiple inheritance support. Do you agree or disagree? Why? Can you think of any ways in which implementing multiple interfaces "falls short" as compared with true multiple inheritance?

  5. The following client code scenarios would each cause compilation errors—can you explain why this is so in each case? Be as precise as possible as to the reasons—they may not be as obvious as first meets the eye!

    Assume that Professor and Student are both classes that implement the ITeacher interface.

    Scenario #1:

            Professor p;
            Student s = new Student();
            ITeacher t;
    
            t = s;
            p = t;
    

    Scenario #2:

            Professor p = new Professor();
            Student s;
            ITeacher t = new Student();
    
            s = t;
    

    Scenario #3:

            Professor p = new Professor();
            Student s = new Student();
            ITeacher t;
    
            p = t;
    

Team LiB
Previous Section Next Section