Oop Presentation Abstract Class
Oop Presentation Abstract Class
Another way, it shows only essential things to the user and hides the
internal details, for example, sending SMS where you type the text and send
the message. You don't know the internal processing about the message
delivery.
Abstraction lets you focus on what the object does instead of how it does it.
Real life example
Question: How to achieve Abstraction ?
} }
Non Abstract Abstract class
class
Abstract Method
Non-Abstract method: Abstract method:
Abstract class
Abstraction Example
abstract class MobileUser { class Rahim extends MobileUser {
abstract void sendMessage(); @Override
} void sendMessage(){
System.out.println("Hi, this is Rahim");
public class Test { }
public static void main(String[] args) { }
MobileUser ms; class Karim extends MobileUser {
ms = new Rahim(); @Override
ms = new Karim(); void sendMessage(){
ms.sendMessage(); System.out.println("Hi, this is Karim");
ms.sendMessage(); }
} }
}
At the Conclusion:
• Abstract class defind like, abstract class A { }
• Abstract class can't be instantiated.
• Abstract class can have abstract and non abstract
method( concrete method)
• If you extend an abstract class you have to use all its
abstract methods or you have to declare the class as
abstract itself
“THANK YOU
EVERYONE”