What is Abstraction?
- Abstraction is one of the OOPs concepts.
- Abstraction is use for data hiding.
- If now method in the abstract class is abstract methods still it can be an abstract class (abstract class support 0 -100% abstraction)
- We can not create an instance/object for a abstract class
- Abstract methods have only declaration () but no implementation {}
- Abstract method can over override and thus it support an OOPs concept call method overriding
- In Abstraction we have declaration once but implementation multiple times as per our needs.
Example: - Abstract Class with 0% abstraction
abstract class Abstract{
public void A() {}; // Non Abstract Method
public void B(String S) {}; // Non Abstract Method
This shows that we can create abstract class without any abstract Method
- Abstract Class with 100% abstraction
abstract class Abstract{
abstract void A(); // Abstract Method
abstract void A(String S); // Abstract Method
}
Comments
Post a Comment