adspace
What are the design considerations while making a choice between using interface and abstract class?
Answer Posted / Rakesh Kumar Gupta
When choosing between an interface and an abstract class, consider the following factors:
1. Interfaces promote programming to interfaces rather than implementation classes, making it easier to change or reuse code.
2. Abstract classes can have instance variables and default implementations for methods, whereas interfaces cannot.
3. Interfaces are less verbose but more flexible, while abstract classes offer a compromise between flexibility and complexity.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
No New Questions to Answer in this Category !! You can
Post New Questions
Answer Questions in Different Category