0% found this document useful (0 votes)
44 views

Oop Presentation Abstract Class

This presentation introduces the abstract class in object oriented programming. It defines abstraction as hiding implementation details and exposing only functionality. There are two ways to achieve abstraction: abstract classes and interfaces. Abstract classes can contain both abstract and non-abstract methods, while abstract methods have no body and must be overridden in subclasses. The example shows an abstract MobileUser class with a sendMessage abstract method, and concrete Rahim and Karim classes that extend MobileUser and implement the abstract method.

Uploaded by

Aktu Masti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Oop Presentation Abstract Class

This presentation introduces the abstract class in object oriented programming. It defines abstraction as hiding implementation details and exposing only functionality. There are two ways to achieve abstraction: abstract classes and interfaces. Abstract classes can contain both abstract and non-abstract methods, while abstract methods have no body and must be overridden in subclasses. The example shows an abstract MobileUser class with a sendMessage abstract method, and concrete Rahim and Karim classes that extend MobileUser and implement the abstract method.

Uploaded by

Aktu Masti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

WELCOME TO MY PRESENTATION

PRESENTATION TOPIC : ABSTRACT CLASS


COURSE TITLE : OBJECT ORIENTED PROGRAMMING

COURSE CODE: CSE 201 SECTION: D-10

PRESENTED BY: PRESENTED TO:


NAME: MD.RASHED NAME: MD.MOSHIUR RAHMAN
ID: 221002262 LECTURER, DEPT. OF CSE
GREEN UNIVERSITY OF BANGLADESH
What is Abstraction ?
Abstraction is a process of hiding the implementation details and showing
only functionality to the user.

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 ?

There are two ways to achieve abstraction in java


1. Abstract class (0 to 100%)
2. Interface (100%)
Abstract Class
Class MobileUser{ Abstract class MobileUser{

} }
Non Abstract Abstract class
class
Abstract Method
Non-Abstract method: Abstract method:

Void message(){ Abstract void message();


……
} • Points to remember about abstract method.
1. Abstract method has no body     
2. It must be ends with a semicolon
3.It must be in the abstract class.
4.It must be overridden.
1. Abstract class have abstract and non abstract method.
2. Non abstract class can't have abstract method

class MobileUser { abstract class MobileUser {


void call(){
} System.out.println("Hello");
}
abstract void sendMessage();
Non Abstract class
}

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”

You might also like