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 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’.
What is encapsulation in oop?
What is polymorphism in oops with example?
What do you mean by abstraction?
What are the 4 main oop principles?
What is abstraction and encapsulation?
What are benefits of oop?
Why is static class not inherited?
what is difference between class template and template class?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What is the difference between inheritance and polymorphism?
Can static class have constructor?
What is abstract class in oop?
What is the full form of oops?
What does and I oop mean in text?