1. | What is polymorphism? |
|
2. | How is polymorphism implemented? |
|
3. | What is late binding? |
|
4. | What is early binding? |
|
5. | What is the advantage of run-time polymorphism? |
|
6. | What is the advantage of compile-time polymorphism? |
|
7. | What is an interface? |
|
8. | How does polymorphism enable the implementation of an interface? |
|
9. | What is a virtual function? |
|
10. | What is overloading a method? |
|
Answers
1. | Polymorphism technically means that one thing has the ability to take many shapes . In programming terms, the thing is the name of a method and the shape is the behavior performed by the method. |
2. | Polymorphism is implemented by overloading a method or by using virtual functions. |
3. | Late binding is the binding of a method call to a method definition and is performed at run time if some information is missing at compile time that is known only when the application runs. |
4. | Early binding is the binding of a method call to a method definition and is performed at compile time if all the information is available at compile time. |
5. | The advantage of run-time polymorphism is that a program can respond to events that occur during execution. |
6. | The advantage of compile-time polymorphism is that no time is lost in binding when the program runs because binding is completed when the executable program is created. |
7. | An interface specifies a standard method name, argument list, return value, and behavior. Programmers who develop classes and methods define methods that adhere to an interface. |
8. | Polymorphism permits an interface to be defined as a set of standard methods and behaviors by using overloaded methods and virtual methods. |
9. | A virtual function is a placeholder for the real function that is defined when the programming is running. |
10. | Overloading is a technique for implementing polymorphism by defining two or more methods with the same name but different argument lists. |