1. | What is an interface? |
|
2. | What is an interface diagram? |
|
3. | Why is an interface used in a program? |
|
4. | What is the difference between an interface and a user interface? |
|
5. | Does the C programming language use interfaces? |
|
6. | What kind of inheritance is similar to an interface? |
|
7. | Can an interface be used with C++? |
|
8. | Why do Java and C# support interfaces? |
|
9. | What is a component? |
|
10. | Give an example of a component. |
|
Answers
1. | An interface specifies what a class must do, but not how it does it. It is syntactically similar to a class, but its methods are declared without any body. A class implements an interface by creating a complete set of methods defined by the interface. |
2. | An interface diagram shows how a class can implement an interface. |
3. | An interface is used in a program to enable similar classes to have a standard behavior while having the programmer who builds these classes define how the behavior is performed. |
4. | The purpose of a user interface is to enable a user to use a program. An interface is a standard behavior. Programmers who use a class that implements an interface can expect that the class will define a set of standard methods. Programmers who build classes for use by other programmers must define a set of standard methods that conform to a standard interface. |
5. | The C programming language doesn t use an interface because C is not an object-oriented programming language. |
6. | An interface is similar to multiple inheritance. |
7. | C++ does not support an interface, but it does support multiple inheritance. |
8. | Java and C# support interfaces because they do not support multiple inheritance. |
9. | A component is a class designed to fit into some preexisting class framework and may do so through inheritance or by implementing one or more interfaces. However, it must follow its environment s rules for components . |
10. | An Integrated Development Environment is a good example because it enables programmers to drag and drop components such as buttons from a tool palette onto a form. |