Self-Review Exercises

  1. 12.1 Fill in the blanks in each of the following statements:

    1. If a class contains at least one abstract method, it must be declared as a(n)             class.

    2. Classes from which objects can be instantiated are called             classes.

    3.             involves using a base-class variable to invoke methods on base-class and derived-class objects, enabling you to “program in the general.”

    4. Methods in a class that do not provide implementations must be declared using keyword            .

    5. Casting a reference stored in a base-class variable to a derived-class type is called            .

  2. 12.2 State whether each of the statements that follows is true or false. If false, explain why.

    1. It’s possible to treat base-class objects and derived-class objects similarly.

    2. All methods in an abstract class must be declared as abstract methods.

    3. Attempting to invoke a derived-class-only method through a base-class variable is an error.

    4. If a base class declares an abstract method, a derived class must implement that method.

    5. An object of a class that implements an interface may be thought of as an object of that interface type.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset