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

WHAT'S THE OOPS BASIC OOPS CONCEPTS IN DOTNET

1 Answers  


what is multithreading in c++ , what is difference between multithreading and singlethreading.

4 Answers  


write a short note on Overloading of Binary Operator?

2 Answers  


What are the four main oops concepts?

1 Answers  


What is encapsulation process?

0 Answers  






How to improve object oriented design skills?

0 Answers  


write a c++ program to find maximum of two numbers using inline functions.

3 Answers   IBM,


I am DeePu sotware engineer working with EMC corporation ,recently I had attended mcafee interview . Their questions were at heights of stupidity , I don't know what they want , I am a developer with 4 year experienced .I am listing the questions asked 1:What is the flag in g++ to avoid structure padding 2:In wht order parameters are passed to stack 3:How you will edit code segment of an exe

1 Answers  


What is multidimensional array?

1 Answers  


what is the difference between class and structure in C++?

9 Answers   Aspire, IBS, TCS,


what is code for call by value and call by reference?

1 Answers  


Why is encapsulation used?

0 Answers  


Categories