Follow Our FB Page << >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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
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 is virtual Function.

1 Answers   Wipro,

What do you mean by inline function?

6 Answers  

What is stream in oop?

0 Answers  

#include <string.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort

0 Answers  

what is the difference between class and object?

9 Answers  

Write pseudo code for push in a stack?

2 Answers   emc2,

what is the usage of clas templates

5 Answers  

design class for linked list and include constructor,destructor,insert option. struct node { int node; struct node &ptr; }

1 Answers   HSBC,

What is conditional Compilation?

3 Answers   emc2, HCL,

Can enum be null?

0 Answers  

what are abstract classes and how they impliment , with example

2 Answers  

should we use linear search or binary search if elements are placed in random order or mixed?in both cases? i need a little bit detail ans?thnks

2 Answers