Abstraction is a process of showing functionality and hiding other internal/implementation details.
2. Interface
Simple Example of Abstract Class:-
Every non abstract subclass of MyGraphic must provide implementations for the draw and resize method:-
Achieving Abstraction via:-
1. Abstract class2. Interface
Abstract class:-
Abstract class is a class which cannot be instantiated but they can be sub classed. We can declare abstract class by using abstract keyword.- Only abstract class can have abstract method (abstract method is a method that is declared without an implementation).
- We cannot use private and static method in abstract class.
Simple Example of Abstract Class:-
Every non abstract subclass of MyGraphic must provide implementations for the draw and resize method:-
No comments:
Post a Comment