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


Please Help Members By Posting Answers For Below Questions

write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1780


What is encapsulation in oop?

607


What is polymorphism in oops with example?

533


What do you mean by abstraction?

617


What are the 4 main oop principles?

685






What is abstraction and encapsulation?

575


What are benefits of oop?

639


Why is static class not inherited?

599


what is difference between class template and template class?

2159


Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

3555


What is the difference between inheritance and polymorphism?

592


Can static class have constructor?

585


What is abstract class in oop?

534


What is the full form of oops?

612


What does and I oop mean in text?

625