Give any criteria when you use an abstract class and an interface?



Give any criteria when you use an abstract class and an interface?..

Answer / Anurag Choubey

1. Abstract Classes are used when you want to enforce a common behavior across all subclasses but also allow for implementation differences. They can contain both abstract and concrete methods. 2. Interfaces are used when you want to define a contract or set of methods that classes should implement, without providing any implementation. Multiple classes can implement the same interface.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOAD Interview Questions

Can I implement polymorphism using abstract class?

1 Answers   MCN Solutions,


Can an interface inherit from another interface?

1 Answers  


What is the difference between an error and an exception?

1 Answers  


What is guard condition?

8 Answers   Mannar Company, Syntel,


Why do we use oops concepts? What is its advantage?

1 Answers  


Explain about the analysis phase?

1 Answers  


How many instances can be created for an abstract class?

1 Answers  


What is the benefit of Composition over Inheritance?

1 Answers  


Explain the abstract class modifier?

1 Answers  


what is the difference between the up phase and up workflows?

1 Answers  


What is association?

2 Answers   Protech, Wipro,


What does the keyword virtual represented in the method definition?

1 Answers  


Categories