In which Scenario you will go for Interface or Abstract Class?
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 |
What is encapsulation?
What is a unary operator?
Why do we use class in oops?
Write a program to demonstrate the use of 'Composition' in C++
What is public, protected, private?
What exactly is polymorphism?
whats the difference between c and c++
What is a linked list?
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
What is late bound function call and early bound function call? Differentiate.
define a string class. overload the operator == to compare two strings
2 Answers Birla, Ericsson, HCL, Infosys, Infotech, MCAS, Satyam,
Where You Can Use Interface in your Project