In which Scenario you will go for Interface or Abstract Class?



In which Scenario you will go for Interface or Abstract Class?..

Answer / swetcha

Interfaces, like classes, define a set of properties,
methods, and events. But unlike classes, interfaces do not
provide implementation. They are implemented by classes,
and defined as separate entities from classes. Even though
class inheritance allows your classes to inherit
implementation from a base class, it also forces you to
make most of your design decisions when the class is first
published.
Abstract classes are useful when creating components
because they allow you specify an invariant level of
functionality in some methods, but leave the implementation
of other methods until a specific implementation of that
class is needed. They also version well, because if
additional functionality is needed in derived classes, it
can be added to the base class without breaking code.

Is This Answer Correct ?    12 Yes 2 No

Post New Answer

More OOPS Interview Questions

why c++ is a highlevel language

3 Answers   Satyam, Tech Mahindra,


What is this interview room ? Is it a class or an object.

3 Answers   CybAge, NSN, Wipro,


What do you mean by binding of data and functions?

3 Answers  


Difference between new operator and operator new

2 Answers  


How do you answer polymorphism?

0 Answers  






what is difference b/w object based and object oriented programming language?

18 Answers   Chaitanya, College School Exams Tests, Educomp, IBM, Infosys, Telko,


what is the use of template classes in c++

1 Answers  


Why do we use encapsulation in oops?

0 Answers  


What is constructor in oop?

0 Answers  


What are the benefits of interface?

0 Answers  


What is the difference between the c++ & java?

2 Answers  


Write a c++ program to display pass and fail for three student using static member function

0 Answers  


Categories