SlideShare a Scribd company logo
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.
Ad

More Related Content

What's hot (20)

CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
Functions in C
Functions in CFunctions in C
Functions in C
Shobhit Upadhyay
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
Tech_MX
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
Raja Sekhar
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
Ritika Sharma
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
Pooja Jaiswal
 
Type casting
Type castingType casting
Type casting
simarsimmygrewal
 
python Function
python Function python Function
python Function
Ronak Rathi
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
rprajat007
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
Marlom46
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
Harsh Patel
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
03062679929
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
David Livingston J
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
Venkata.Manish Reddy
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
Tech_MX
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
Ritika Sharma
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
Pooja Jaiswal
 
python Function
python Function python Function
python Function
Ronak Rathi
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
rprajat007
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
Marlom46
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
Harsh Patel
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
03062679929
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 

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

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

More from Hitesh Kumar (20)

HTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview QuestionsHTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview Questions
Hitesh Kumar
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
Hitesh Kumar
 
CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience
Hitesh Kumar
 
Factorial Program in C
Factorial Program in CFactorial Program in C
Factorial Program in C
Hitesh Kumar
 
Prime number program in C
Prime number program in CPrime number program in C
Prime number program in C
Hitesh Kumar
 
Top JSON Interview Questions for Freshers
Top JSON Interview Questions for FreshersTop JSON Interview Questions for Freshers
Top JSON Interview Questions for Freshers
Hitesh Kumar
 
Queue in C, Queue Real Life of Example
Queue in C, Queue Real Life of ExampleQueue in C, Queue Real Life of Example
Queue in C, Queue Real Life of Example
Hitesh Kumar
 
Fibonacci series c++
Fibonacci series c++Fibonacci series c++
Fibonacci series c++
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Interface in java
Interface in javaInterface in java
Interface in java
Hitesh Kumar
 
Encapsulation in C++
Encapsulation in C++Encapsulation in C++
Encapsulation in C++
Hitesh Kumar
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
Hitesh Kumar
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Ternary operator
Ternary operatorTernary operator
Ternary operator
Hitesh Kumar
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
Hitesh Kumar
 
Main method in java
Main method in javaMain method in java
Main method in java
Hitesh Kumar
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
HTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview QuestionsHTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview Questions
Hitesh Kumar
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
Hitesh Kumar
 
CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience
Hitesh Kumar
 
Factorial Program in C
Factorial Program in CFactorial Program in C
Factorial Program in C
Hitesh Kumar
 
Prime number program in C
Prime number program in CPrime number program in C
Prime number program in C
Hitesh Kumar
 
Top JSON Interview Questions for Freshers
Top JSON Interview Questions for FreshersTop JSON Interview Questions for Freshers
Top JSON Interview Questions for Freshers
Hitesh Kumar
 
Queue in C, Queue Real Life of Example
Queue in C, Queue Real Life of ExampleQueue in C, Queue Real Life of Example
Queue in C, Queue Real Life of Example
Hitesh Kumar
 
Fibonacci series c++
Fibonacci series c++Fibonacci series c++
Fibonacci series c++
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Encapsulation in C++
Encapsulation in C++Encapsulation in C++
Encapsulation in C++
Hitesh Kumar
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
Hitesh Kumar
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
Hitesh Kumar
 
Main method in java
Main method in javaMain method in java
Main method in java
Hitesh Kumar
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Ad

Recently uploaded (20)

Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 

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.