1. | What is abstraction? | |
2. | When should abstraction be used in a program? | |
3. | What is an abstract method? | |
4. | Can an abstract method be called within a program? | |
5. | What happens if an abstract method is not redefined? | |
6. | Can an instance of an abstract class be declared in a program? | |
7. | Can an abstract method be called directly by a subclass? | |
8. | Must an abstract method be redefined by a subclass? | |
9. | Must all methods in an abstract class be designated as abstract? | |
10. | Must all methods in an abstract class be redefined in a subclass? | |
Answers
1. | Abstraction is a way for the programmer of a super class to require the programmer of a subclass to define a method. |
2. | Abstraction should be used in a program when there isn t any way to define a good default method in the super class. |
3. | An abstract method is a method defined in a super class that must be redefined in a subclass that inherits the super class. |
4. | An abstract method cannot be called within a program. |
5. | A compiler error occurs if an abstract method is not redefined. |
6. | An instance of an abstract class cannot be declared in a program. |
7. | An abstract method cannot be called directly by a subclass. |
8. | A programmer of a subclass that inherits an abstract super class must redefine the abstract methods defined in the subclass, even if those methods are not called within the application. |
9. | A super class can contain a mixture of abstract methods and non-abstract methods. |
10. | Only abstract methods must be redefined in a subclass that inherits from the abstract super class. |