SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
Sitesbay.com
Abstraction in C++
Real Life Example of Abstraction in C++
Hitesh Kumar
SITESBAY.COM
Sitesbay.com
Abstraction in C++
Real Life Example of Abstraction in C++
Sitesbay.com
Abstraction in C++
AbstractioninC++ is not newconceptitisoop’sconceptwhichis usedtohide backgrounddetail and
showonlyessential features.
Data abstractionis a processof representingthe essential featureswithoutincludingimplementation
details.
Data abstractionis the processof representingessentialdetailsnotincludinginternal details.Example
index of the book
Data abstractionrefersto,providingonly essentialfeaturesbyhidingitsbackgrounddetails.
Example of AbstractioninC++:
classresult
{
intmarks;
floatpercentage;
char name[20];
Sitesbay.com
voidinput();
voidoutput();
}
main()
{
bankb1;
b1.input();
b1.output();
}
In the above example,b1isan objectcallinginputandoutputmemberfunctions,butthatcode is
invisible tothe objectb1.
Abstract Class
AbstractClassis a class whichcontainsatleastone Pure Virtual functioninit.
Characteristics of Abstract Class
 Abstractclass cannotbe instantiated,butpointersandreferencesof Abstractclasstype canbe
created.
 Abstractclass can have normal functionsandvariablesalongwithapure virtual function.
 Abstractclassesare mainly usedforUp-casting,sothatits derivedclassescanuse itsinterface.
 ClassesinheritinganAbstractClassmustimplementall pure virtual functions,orelse theywill
become Abstracttoo.
Sitesbay.com
1. Real Life Example of Abstraction in C++
Suppose you are operating a mobile phone. You know that the important feature of a
phone is the memory card, SIM, battery life, design and build, and processor power. But,
while operating the phone you do not get into the operational details of the phone such
as how the CPU of the phone allocates memory for the various media on your phone or
other intricate architectural details of the phone. All these details aren’t visible to cell-
phone users from a non-technical background.
2. Real Life Example of Abstraction in C++
A man driving a car. The man only knows that pressing the accelerators will
increase the speed of car or applying brakes will stop the car but he does not
know about how on pressing accelerator the speed is actually increasing, he does
not know about the inner mechanism of the car or the implementation of
accelerator, brakes etc in the car.
Advantages of Data Abstraction in C++
How we discuss about some advantages of data abstraction;
1. Data abstraction increases the reusability of the code by avoiding any chances of
redundancy.
2. It increases the readability of the code as it eliminates the possibility of displaying the
complex working of the code.
3. With the implementation of classes and objects, comes enhanced security. Since data
abstraction is a method of implementing classes and objects any denying access to other
classes of accessing the data members and member functions of the base class.
Sitesbay.com
4. It helps the user to write a high-level code.
5. It separates the entire program into code and implementation making it more
comprehensible.
Designing Strategy of Abstraction
Abstraction separates code into interface and implementation. So while designing your
component, you must keep interface independent of the implementation so that if you
change underlying implementation then interface would remain intact.
In this case whatever programs are using these interfaces, they would not be impacted
and would just need a recompilation with the latest implementation.

More Related Content

PPTX
Access specifiers(modifiers) in java
PPTX
Constructors in C++
PPTX
Polymorphism in c++(ppt)
PPTX
INLINE FUNCTION IN C++
PPTX
Member Function in C++
PPTX
Arrays in Java
PPT
Operator Overloading
PPT
Function overloading(c++)
Access specifiers(modifiers) in java
Constructors in C++
Polymorphism in c++(ppt)
INLINE FUNCTION IN C++
Member Function in C++
Arrays in Java
Operator Overloading
Function overloading(c++)

What's hot (20)

PDF
Function overloading ppt
PPT
Class and object in C++
PPTX
Constructor and Types of Constructors
PPTX
Inheritance in c++
PPTX
java interface and packages
PPTX
Constructor in java
PPTX
Inheritance in c++
PPTX
classes and objects in C++
PPTX
Object Oriented Programming Using C++
PPTX
Polymorphism In c++
PPTX
Inheritance in java
PPTX
Inheritance in java
PPTX
Abstract class in c++
PPTX
07. Virtual Functions
PPTX
[OOP - Lec 08] Encapsulation (Information Hiding)
PPTX
Access specifier
PDF
Java threads
PPTX
Classes, objects in JAVA
PPT
PDF
Constructors and Destructors
Function overloading ppt
Class and object in C++
Constructor and Types of Constructors
Inheritance in c++
java interface and packages
Constructor in java
Inheritance in c++
classes and objects in C++
Object Oriented Programming Using C++
Polymorphism In c++
Inheritance in java
Inheritance in java
Abstract class in c++
07. Virtual Functions
[OOP - Lec 08] Encapsulation (Information Hiding)
Access specifier
Java threads
Classes, objects in JAVA
Constructors and Destructors
Ad

Similar to Abstraction in c++ and Real Life Example of Abstraction in C++ (20)

PDF
T2
PDF
C++ [ principles of object oriented programming ]
PPTX
PPTX
PDF
PDF
Object Oriented Programming using C++ PCIT102.pdf
PPTX
object oriented programming language in c++
PDF
C++
PPT
C++ Functions
PPTX
Azure IoT Hub on a Toradex Colibri VF61 – Part 3: Using Cloud Services to col...
TXT
why c++11?
PDF
02 c++g3 d (1)
PPTX
DATA ABSTRACTION.pptx
PPTX
Principal of objected oriented programming
PDF
C 20 for Programmers 3rd Edition P. Deitel
PPT
C++ functions
PPTX
Principles of object oriented programing
PDF
Migrating From Cpp To C Sharp
PDF
Absolute C++ 6th Edition Savitch Solutions Manual
T2
C++ [ principles of object oriented programming ]
Object Oriented Programming using C++ PCIT102.pdf
object oriented programming language in c++
C++
C++ Functions
Azure IoT Hub on a Toradex Colibri VF61 – Part 3: Using Cloud Services to col...
why c++11?
02 c++g3 d (1)
DATA ABSTRACTION.pptx
Principal of objected oriented programming
C 20 for Programmers 3rd Edition P. Deitel
C++ functions
Principles of object oriented programing
Migrating From Cpp To C Sharp
Absolute C++ 6th Edition Savitch Solutions Manual
Ad

More from Hitesh Kumar (20)

PDF
HTML Interview Questions | Basic Html Interview Questions
PDF
Fibonacci Series Program in C++
PDF
CSS Interview Questions for Fresher and Experience
PDF
Factorial Program in C
PDF
Prime number program in C
PDF
Top JSON Interview Questions for Freshers
PDF
Queue in C, Queue Real Life of Example
PDF
Fibonacci series c++
PPTX
Super keyword in java
DOCX
Interface in java
DOCX
Encapsulation in C++
DOCX
Abstract class in java
PPTX
Super keyword in java
PPTX
Final keyword in java
PPTX
Constructor in java
PPTX
Super keyword in java
PPTX
Ternary operator
PPT
File handling in C++
PPTX
Main method in java
PPTX
This keyword in java
HTML Interview Questions | Basic Html Interview Questions
Fibonacci Series Program in C++
CSS Interview Questions for Fresher and Experience
Factorial Program in C
Prime number program in C
Top JSON Interview Questions for Freshers
Queue in C, Queue Real Life of Example
Fibonacci series c++
Super keyword in java
Interface in java
Encapsulation in C++
Abstract class in java
Super keyword in java
Final keyword in java
Constructor in java
Super keyword in java
Ternary operator
File handling in C++
Main method in java
This keyword in java

Recently uploaded (20)

PPTX
Cell Types and Its function , kingdom of life
PDF
Pre independence Education in Inndia.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Computing-Curriculum for Schools in Ghana
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Lesson notes of climatology university.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
Cell Types and Its function , kingdom of life
Pre independence Education in Inndia.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
VCE English Exam - Section C Student Revision Booklet
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
GDM (1) (1).pptx small presentation for students
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Sports Quiz easy sports quiz sports quiz
Computing-Curriculum for Schools in Ghana
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Anesthesia in Laparoscopic Surgery in India
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Module 4: Burden of Disease Tutorial Slides S2 2025
Lesson notes of climatology university.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Renaissance Architecture: A Journey from Faith to Humanism

Abstraction in c++ and Real Life Example of Abstraction in C++

  • 1. Sitesbay.com Abstraction in C++ Real Life Example of Abstraction in C++ Hitesh Kumar SITESBAY.COM
  • 2. Sitesbay.com Abstraction in C++ Real Life Example of Abstraction in C++
  • 3. Sitesbay.com Abstraction in C++ AbstractioninC++ is not newconceptitisoop’sconceptwhichis usedtohide backgrounddetail and showonlyessential features. Data abstractionis a processof representingthe essential featureswithoutincludingimplementation details. Data abstractionis the processof representingessentialdetailsnotincludinginternal details.Example index of the book Data abstractionrefersto,providingonly essentialfeaturesbyhidingitsbackgrounddetails. Example of AbstractioninC++: classresult { intmarks; floatpercentage; char name[20];
  • 4. Sitesbay.com voidinput(); voidoutput(); } main() { bankb1; b1.input(); b1.output(); } In the above example,b1isan objectcallinginputandoutputmemberfunctions,butthatcode is invisible tothe objectb1. Abstract Class AbstractClassis a class whichcontainsatleastone Pure Virtual functioninit. Characteristics of Abstract Class  Abstractclass cannotbe instantiated,butpointersandreferencesof Abstractclasstype canbe created.  Abstractclass can have normal functionsandvariablesalongwithapure virtual function.  Abstractclassesare mainly usedforUp-casting,sothatits derivedclassescanuse itsinterface.  ClassesinheritinganAbstractClassmustimplementall pure virtual functions,orelse theywill become Abstracttoo.
  • 5. Sitesbay.com 1. Real Life Example of Abstraction in C++ Suppose you are operating a mobile phone. You know that the important feature of a phone is the memory card, SIM, battery life, design and build, and processor power. But, while operating the phone you do not get into the operational details of the phone such as how the CPU of the phone allocates memory for the various media on your phone or other intricate architectural details of the phone. All these details aren’t visible to cell- phone users from a non-technical background. 2. Real Life Example of Abstraction in C++ A man driving a car. The man only knows that pressing the accelerators will increase the speed of car or applying brakes will stop the car but he does not know about how on pressing accelerator the speed is actually increasing, he does not know about the inner mechanism of the car or the implementation of accelerator, brakes etc in the car. Advantages of Data Abstraction in C++ How we discuss about some advantages of data abstraction; 1. Data abstraction increases the reusability of the code by avoiding any chances of redundancy. 2. It increases the readability of the code as it eliminates the possibility of displaying the complex working of the code. 3. With the implementation of classes and objects, comes enhanced security. Since data abstraction is a method of implementing classes and objects any denying access to other classes of accessing the data members and member functions of the base class.
  • 6. Sitesbay.com 4. It helps the user to write a high-level code. 5. It separates the entire program into code and implementation making it more comprehensible. Designing Strategy of Abstraction Abstraction separates code into interface and implementation. So while designing your component, you must keep interface independent of the implementation so that if you change underlying implementation then interface would remain intact. In this case whatever programs are using these interfaces, they would not be impacted and would just need a recompilation with the latest implementation.