In which Scenario you will go for Interface or Abstract Class?
Answer Posted / 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 View All Answers
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< What is purpose of inheritance? What is encapsulation in oop? write string class as your own class in java without using
any built-in function Explain the concepts involved in Object Oriented programming. What is constructor in oop? What are the components of marker interface? What is the difference between a mixin and inheritance? Why do we use polymorphism? What is encapsulation with real life example? What is difference between data abstraction and encapsulation? When not to use object oriented programming? If a=5, b=6, c=7, b+=a%c*2. What is the final value of b? What are the 3 pillars of oop? What is oops and why we use oops?