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

What's hot (20)

PPTX
Inline function in C++
Jenish Patel
 
PPTX
Java abstract class & abstract methods
Shubham Dwivedi
 
PPTX
Friend function
zindadili
 
PDF
Operator overloading
Pranali Chaudhari
 
PPTX
Introduction Of C++
Sangharsh agarwal
 
PPTX
OOPS Basics With Example
Thooyavan Venkatachalam
 
PPTX
class and objects
Payel Guria
 
PPTX
Virtual base class
Tech_MX
 
PDF
Arrays in Java
Naz Abdalla
 
PPTX
Inheritance in c++
Vineeta Garg
 
PPTX
Association agggregation and composition
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Strings in Java
Abhilash Nair
 
PPT
Class and object in C++
rprajat007
 
PPTX
virtual function
VENNILAV6
 
PPT
friend function(c++)
Ritika Sharma
 
PPTX
Exception handling c++
Jayant Dalvi
 
PPTX
Characteristics of OOPS
abhishek kumar
 
PPSX
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
PDF
Function overloading ppt
Prof. Dr. K. Adisesha
 
Inline function in C++
Jenish Patel
 
Java abstract class & abstract methods
Shubham Dwivedi
 
Friend function
zindadili
 
Operator overloading
Pranali Chaudhari
 
Introduction Of C++
Sangharsh agarwal
 
OOPS Basics With Example
Thooyavan Venkatachalam
 
class and objects
Payel Guria
 
Virtual base class
Tech_MX
 
Arrays in Java
Naz Abdalla
 
Inheritance in c++
Vineeta Garg
 
Association agggregation and composition
baabtra.com - No. 1 supplier of quality freshers
 
Strings in Java
Abhilash Nair
 
Class and object in C++
rprajat007
 
virtual function
VENNILAV6
 
friend function(c++)
Ritika Sharma
 
Exception handling c++
Jayant Dalvi
 
Characteristics of OOPS
abhishek kumar
 
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
Function overloading ppt
Prof. Dr. K. Adisesha
 

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

PDF
T2
lksoo
 
PDF
C++ [ principles of object oriented programming ]
Rome468
 
PPTX
Anagha
Anaghabalakrishnan
 
PPTX
What is c++ programming
PSK Technolgies Pvt. Ltd. IT Company Nagpur
 
PDF
Part 1
Moatez Amairi
 
PDF
Object Oriented Programming using C++ PCIT102.pdf
GauravKumar295392
 
PPTX
object oriented programming language in c++
Ravikant517175
 
PDF
C++
Rome468
 
PPT
C++ Functions
sathish sak
 
PPTX
Azure IoT Hub on a Toradex Colibri VF61 – Part 3: Using Cloud Services to col...
Toradex
 
TXT
why c++11?
idrajeev
 
PDF
02 c++g3 d (1)
Mohammed Ali
 
PPTX
DATA ABSTRACTION.pptx
ManavSharma694627
 
PPTX
Principal of objected oriented programming
Rokonuzzaman Rony
 
PDF
C 20 for Programmers 3rd Edition P. Deitel
mavusitacoo
 
PPT
C++ functions
Mayank Jain
 
PPTX
Principles of object oriented programing
Ahammed Alamin
 
PDF
Migrating From Cpp To C Sharp
Ganesh Samarthyam
 
PDF
Absolute C++ 6th Edition Savitch Solutions Manual
delkankie
 
T2
lksoo
 
C++ [ principles of object oriented programming ]
Rome468
 
Object Oriented Programming using C++ PCIT102.pdf
GauravKumar295392
 
object oriented programming language in c++
Ravikant517175
 
C++
Rome468
 
C++ Functions
sathish sak
 
Azure IoT Hub on a Toradex Colibri VF61 – Part 3: Using Cloud Services to col...
Toradex
 
why c++11?
idrajeev
 
02 c++g3 d (1)
Mohammed Ali
 
DATA ABSTRACTION.pptx
ManavSharma694627
 
Principal of objected oriented programming
Rokonuzzaman Rony
 
C 20 for Programmers 3rd Edition P. Deitel
mavusitacoo
 
C++ functions
Mayank Jain
 
Principles of object oriented programing
Ahammed Alamin
 
Migrating From Cpp To C Sharp
Ganesh Samarthyam
 
Absolute C++ 6th Edition Savitch Solutions Manual
delkankie
 
Ad

More from Hitesh Kumar (20)

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

Recently uploaded (20)

PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Horarios de distribución de agua en julio
pegazohn1978
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 

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.