SlideShare a Scribd company logo
1 of 16
PRESENTATION
OF C++
TOPIC : ABSTRACTION
C++
Submitted to :
Jyoti Kaurav Mam
NAME KRISHAN KUMAR CHAUHAN
ROLL NO 215/ICS/054
PROGRAMME NAME INTEGRATED B.TECH-M.TECH (CSE)
COURSE NAME PROBLEM SOLVING USING C++
COURSE CODE CS207
TABLE OF CONTANTS
4
1. TOPIC
2. INTRODUCTION
3. SYNTAX
4. PROGRAM
5. APPLICATION
6. CONSEQUENCES
TOPIC
5
ABSTRACTION
Abstraction refers to the act of representing the crucial requisite
features without including the additional explanations of such
features. Hence, it means providing the end-user with their needs but
without the details of how the needs were fulfilled.
For instance, we know how the switches at our houses work. Say for
the fans, we just simply turn on the switch if we want to switch it on,
or turn off the switch if we want to switch it off. In the case of fans,
we can even use the regulator to adjust the speed according to our
needs.Thus, we know all the features but we don’t know what the
background implementation is.This is a real-life example of data
abstraction.
INTRODUCTION
Abstraction is a process that is important to the creation of
computer programs.
In this presentation we are going to talk about the nature of abstraction with
regards to Object Orientation.
There are 2 types of abstraction in C++:
1. Data Abstraction: It hides the information about the data.
2. Control Abstraction: It hides the information about the implementation.
Abstract Classes
# In C++ we can make use of abstract classes to provide structure with no possibility of
implementation.
#These classes provide the necessary contract for C++ to make use of dynamic binding
in a system.
#These classes known as concrete class.
Abstraction:
# Process of successively filtering out low level details.
# Replace with a high level view of system interactions.
# Helped by the use of diagrams and other notations (URL and such).
# Important skill in gaining big picture understanding of how classes interact.
Abstract Classes
In C++ abstract classes created using special syntax for class
declaration:
abstract class Student {
private String matriculationCode;
private String name;
private String address;
public Student (String m. String n, String a) {
matriculation Code = m;
name = n;
address = a;
}
public String getName() { return name:
{
public String getCode() { return mainculationCode.
}
public String getAddress() { return address,
}
}
Abstract Classes
Individual methods all possible to declare as abstract:
abstract class Student {
private String matriculation Code;
Private String name;
private String address;
public Student (String m, Sting n, String a) {
matriculation Code=m;
name=n;
address=a;
}
public String getName() { return name:
}
public String getCode()
return matriculationCode;
}
public String getAddress() {
return address;
}
abstract public int getLoan(): abstract public String getStatus():
}
PROGRAM USING ABSTRACTION CLASS
// C++ Program to Demonsate the
// working of Abstraction
#include <iostream>
using namespace std;
class implementAbstraction {
private:
int a, b;
public:
// method to set values of
// private members
void set(int x, int y)
{
a = x;
b = y;
}
void display()
{
cout << "a = " << a << endl;
cout << "b = " << b << endl;
}
};
int main()
{
implementAbstraction obj;
obj.set(10, 20);
obj.display();
return 0;
}
Output
a = 10
b = 20
….You can see in the above program we are not allowed to access the
variables a and b directly, however, one can call the function set() to set
the values in a and b and the function display() to display the values of a
and b.
APPLICATIONS OF ABSTRACTION
1. Abstraction increases the reusability of the code because of the proper
partitioning.
2. It reduces the complexity as well as the redundancy of the code, hence increasing
the readability.
3. Using classes and objects increases the security of the code.We can declare the
parts of the code as private to keep them secure.
4. Due to abstraction, the important parts of the code are secure as only the
essential features are provided to the user and they don’t know the background
details.
5. Since the programmer can use the same code repeatedly, it helps us perform
similar tasks for similar operations.
6. Abstraction allows changing internal implementations without affecting its user-
level code.
CONSIQUENCIES OF ABSTRACTION
Naturally, abstractions are a "good thing" for the most part, but if they're badly done,
they can be disasterous. Even if they're well-done, they have a cost as relates to raw
performance:
• Simple speed. In order to execute an abstraction, the code implementing needs to
handle cases and situations which may not always be needed - or often aren't
needed - by many usage scenarios.This will typically make code using the
abstractions slower than it would be if the code directly implemented the operation
without using the abstraction.
• Code size.This rarely matters on larger systems nowadays, but it can be a significant
problem in small devices or constrained environments.The extra code needed to
fully implement an abstraction adds linecount and ultimately code size, and if the
code isn't carefully implemented, can end up "pulling in" lots of extra code, leading to
overlarge runtime executables and ultimately making the device itself more
expensive.
THANKYOU
BY – KRISHAN KUMAR CHAUHAN
215/ICS/054

More Related Content

Similar to C++ Abstraction: Data and Control Abstraction in C++ Classes

I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)Jay Patel
 
OOP-Advanced Programming with c++
OOP-Advanced Programming with c++OOP-Advanced Programming with c++
OOP-Advanced Programming with c++Mohamed Essam
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01Zafor Iqbal
 
Programming in Java: Why Object-Orientation?
Programming in Java: Why Object-Orientation?Programming in Java: Why Object-Orientation?
Programming in Java: Why Object-Orientation?Martin Chapman
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 
Java programming concept
Java programming conceptJava programming concept
Java programming conceptSanjay Gunjal
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1RubaNagarajan
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptishan743441
 
Bca winter 2013 2nd sem
Bca winter 2013 2nd semBca winter 2013 2nd sem
Bca winter 2013 2nd semsmumbahelp
 
Oo Design And Patterns
Oo Design And PatternsOo Design And Patterns
Oo Design And PatternsAnil Bapat
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAttila Bertók
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singhdheeraj_cse
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++Amresh Raj
 

Similar to C++ Abstraction: Data and Control Abstraction in C++ Classes (20)

I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
OOP in java
OOP in javaOOP in java
OOP in java
 
OOP-Advanced Programming with c++
OOP-Advanced Programming with c++OOP-Advanced Programming with c++
OOP-Advanced Programming with c++
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Programming in Java: Why Object-Orientation?
Programming in Java: Why Object-Orientation?Programming in Java: Why Object-Orientation?
Programming in Java: Why Object-Orientation?
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.ppt
 
Python-DataAbstarction.pptx
Python-DataAbstarction.pptxPython-DataAbstarction.pptx
Python-DataAbstarction.pptx
 
Bca winter 2013 2nd sem
Bca winter 2013 2nd semBca winter 2013 2nd sem
Bca winter 2013 2nd sem
 
Oo Design And Patterns
Oo Design And PatternsOo Design And Patterns
Oo Design And Patterns
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID Principles
 
C++ Version 2
C++  Version 2C++  Version 2
C++ Version 2
 
Unit 1
Unit  1Unit  1
Unit 1
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 

C++ Abstraction: Data and Control Abstraction in C++ Classes

  • 3. NAME KRISHAN KUMAR CHAUHAN ROLL NO 215/ICS/054 PROGRAMME NAME INTEGRATED B.TECH-M.TECH (CSE) COURSE NAME PROBLEM SOLVING USING C++ COURSE CODE CS207
  • 4. TABLE OF CONTANTS 4 1. TOPIC 2. INTRODUCTION 3. SYNTAX 4. PROGRAM 5. APPLICATION 6. CONSEQUENCES
  • 5. TOPIC 5 ABSTRACTION Abstraction refers to the act of representing the crucial requisite features without including the additional explanations of such features. Hence, it means providing the end-user with their needs but without the details of how the needs were fulfilled. For instance, we know how the switches at our houses work. Say for the fans, we just simply turn on the switch if we want to switch it on, or turn off the switch if we want to switch it off. In the case of fans, we can even use the regulator to adjust the speed according to our needs.Thus, we know all the features but we don’t know what the background implementation is.This is a real-life example of data abstraction.
  • 6. INTRODUCTION Abstraction is a process that is important to the creation of computer programs. In this presentation we are going to talk about the nature of abstraction with regards to Object Orientation. There are 2 types of abstraction in C++: 1. Data Abstraction: It hides the information about the data. 2. Control Abstraction: It hides the information about the implementation.
  • 7. Abstract Classes # In C++ we can make use of abstract classes to provide structure with no possibility of implementation. #These classes provide the necessary contract for C++ to make use of dynamic binding in a system. #These classes known as concrete class.
  • 8. Abstraction: # Process of successively filtering out low level details. # Replace with a high level view of system interactions. # Helped by the use of diagrams and other notations (URL and such). # Important skill in gaining big picture understanding of how classes interact.
  • 9. Abstract Classes In C++ abstract classes created using special syntax for class declaration: abstract class Student { private String matriculationCode; private String name; private String address; public Student (String m. String n, String a) { matriculation Code = m; name = n; address = a; } public String getName() { return name: { public String getCode() { return mainculationCode. } public String getAddress() { return address, } }
  • 10. Abstract Classes Individual methods all possible to declare as abstract: abstract class Student { private String matriculation Code; Private String name; private String address; public Student (String m, Sting n, String a) { matriculation Code=m; name=n; address=a; } public String getName() { return name: } public String getCode() return matriculationCode; } public String getAddress() { return address; } abstract public int getLoan(): abstract public String getStatus(): }
  • 11. PROGRAM USING ABSTRACTION CLASS // C++ Program to Demonsate the // working of Abstraction #include <iostream> using namespace std; class implementAbstraction { private: int a, b; public: // method to set values of // private members void set(int x, int y) { a = x; b = y; }
  • 12. void display() { cout << "a = " << a << endl; cout << "b = " << b << endl; } }; int main() { implementAbstraction obj; obj.set(10, 20); obj.display(); return 0; } Output a = 10 b = 20
  • 13. ….You can see in the above program we are not allowed to access the variables a and b directly, however, one can call the function set() to set the values in a and b and the function display() to display the values of a and b.
  • 14. APPLICATIONS OF ABSTRACTION 1. Abstraction increases the reusability of the code because of the proper partitioning. 2. It reduces the complexity as well as the redundancy of the code, hence increasing the readability. 3. Using classes and objects increases the security of the code.We can declare the parts of the code as private to keep them secure. 4. Due to abstraction, the important parts of the code are secure as only the essential features are provided to the user and they don’t know the background details. 5. Since the programmer can use the same code repeatedly, it helps us perform similar tasks for similar operations. 6. Abstraction allows changing internal implementations without affecting its user- level code.
  • 15. CONSIQUENCIES OF ABSTRACTION Naturally, abstractions are a "good thing" for the most part, but if they're badly done, they can be disasterous. Even if they're well-done, they have a cost as relates to raw performance: • Simple speed. In order to execute an abstraction, the code implementing needs to handle cases and situations which may not always be needed - or often aren't needed - by many usage scenarios.This will typically make code using the abstractions slower than it would be if the code directly implemented the operation without using the abstraction. • Code size.This rarely matters on larger systems nowadays, but it can be a significant problem in small devices or constrained environments.The extra code needed to fully implement an abstraction adds linecount and ultimately code size, and if the code isn't carefully implemented, can end up "pulling in" lots of extra code, leading to overlarge runtime executables and ultimately making the device itself more expensive.
  • 16. THANKYOU BY – KRISHAN KUMAR CHAUHAN 215/ICS/054