Tell me the scenario,Where we can use interfaces or
Abstract class.And What is the difference between
interfaces and abstract class?
Answer Posted / vishal
Abstract Class encapsulates shared(common) behavior and
define place holder for all subclasses
- Define shared behavior
- Can have implementation code
- Can not be instantiated
- A class can be inherited from single abstract
class—Unless language supports Multiple inheritance.
- Provide both abstract and concrete menthods
- Strict IS-A relationship.
Interface: If there is no shared behavior –each subclass
must implement all method defines in a base class this is
called as Interface
- Defines Behavior. It is a cntract and its subclass
must implement it.
- Can not be instantiated
- A class can implemet mutiple interfaces
- Provide only abstract methods
- Not a strict IS-A relationship
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Write a program to sort the number with different sorts in one program ??
Why do we use polymorphism in oops?
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
What is a null tree?
What is static modifier?
What is purpose of inheritance?
How do you achieve runtime polymorphism?
Why is there no multiple inheritance?
How to use CMutex, CSemaphore in VC++ MFC
What is abstraction and encapsulation?
What is balance factor?
Write a program to reverse a string using recursive function?
What is the difference between abstraction and polymorphism?
What are main features of oop?
What is encapsulation example?