SlideShare a Scribd company logo
Object Oriented
Programming
Objects and Classes
Dr. Khalil Ullah
Department of Software Engineering
khalil.ullah@uom.edu.pk
University of Malkand
Bridging the gap between inspiration and aspiration 1
Class
Object
2
Welcome

Object-Oriented Programming
 Mon. Tue. Wed., 9:00–10:00 a.m.
 Instructor: Dr. Khalil Ullah
 Email – Khalil.ullah@uom.edu.pk
 Office hours – Thu. and Fri. 9:30–11:00 am.
 Contact No. 03480916815.
3
Required Textbook
H. M. Deitel and P. J. Deitel, C++ How to Program,
Fifth Edition. Upper Saddle River, NJ: Prentice Hall,
2005. ISBN 0-13-185757-6
Textbook web page:
http://www.deitel.com/books/cppHTP5/index.html
A recommended book (not required):
Ann R. Ford and Toby J. Teorey, Practical Debugging in
C++. Upper Saddle River, NJ: Prentice Hall, 2002.
ISBN 0-13-065394-2
Object Oriented Programming by Robert Lafore
Course Introduction
4
How to Succeed
 Read the chapter before class
 Participate
 In class and in the discussions
 Learn object-oriented programming by
writing a lot of small programs
 To learn C++ programming skills
 To apply those skills in problem solving
 Start the assignments early
 Invest time and work hard!
Course Introduction
5
C++ AND
OBJECT-ORIENTED PROGRAMMING
Some brief facts
6
Historical Perspective
 1968 – The “software crisis”
 NATO Software Engineering Conference in Garmisch,
Germany
 Late projects, high costs, code was hard to maintain
 Ad hoc programming
 Structured programming
 Adapted in the late 1960s to produce programs that
were easy to understand, develop, test, and modify
C++ and Object-Oriented Programming (Deitel; Randell; Wirth)
7
Structured Programming
 Programs should be composed of pieces
that have only one starting point and one
terminating point
 Use only three kinds of “pieces”
1. Sequence
2. Selection control structures
 e.g., if, if/else, switch
3. Repetition control structures
 e.g., while, do/while, for
C++ and Object-Oriented Programming (Deitel; Wirth)
8
Object-Oriented Programming
 Became widely used in the 1990s
 Provided the foundation for real progress in creating software that
is easy to understand, develop, test, and modify
 A way of solving a problem by writing a program that
models the elements in the problem space as objects
 For example, a program used to support a video rental business
would have objects such as a store, videos, and customers
 Programs are collections of objects
 Each object can provide a set of services
 Objects interact by sending messages telling each other what to
do
C++ and Object-Oriented Programming (Deitel; Eckel)
9
Object-Oriented Programming
 Some advantages
 Easy to understand and develop because the objects directly
model real-world elements
 Faster development
 Easier to maintain
 Object-oriented software is easier to reuse
 Object-based programming
 Class – program element that contains both data and the
functions that manipulate it
 Object –instance of a class (like a “variable”)
 Object-oriented programming
 Inheritance
 Polymorphism
C++ and Object-Oriented Programming (Deitel)
10
Brief Facts About C++
 Evolved from C
 Designed and implemented by Bjarne Stroustrup at
the Bell Labs in the early 1980s
 “C with classes”
 Standardized by ISO in 1997
 Includes the C++ standard library
 Standard Template Library (STL)
 Part of the C++ standard library
 Readymade classes for data structures and algorithms
C++ and Object-Oriented Programming (Deitel; Josuttis)
11
INTRODUCTION TO
C++ PROGRAMMING
C++ Features in Chapter 1
12
A Simple Example
 Page 42, Fig. 2.4
 C++ features
 Comments
 Include directive
 main()
 Statements end with semicolons ;
 cout and << for output
 std namespace
 Escape characters, e.g. n
Introduction to C++ Programming (Deitel)
13
1 // Fig. 2.4: fig02_04.cpp
2 // A first program in C++.
3 #include <iostream>
4
5 // function main begins program execution
6 int main()
7 {
8 std::cout << "Welcome to C++!n";
9
10 return 0; // indicate that program ended successfully
11
12 } // end function main
Welcome to C++!
Single-line
comments.
Preprocessor directive to
include input/output stream
header file <iostream>.
Function main appears
exactly once in every C++
program..
Function main returns an
integer value.
Left brace { begins
function body.
Corresponding right
brace } ends function
body.
Statements end with a
semicolon ;.
Name cout belongs to
namespace std.
Stream insertion operator.
Keyword return is one of
several means to exit
function; value 0 indicates
program terminated
successfully.
14
Another Example
 Page 43, Fig. 2.5
 C++ features
 Declaring variables
 Input using cin and >>
 C++ supports many arithmetic operators
+, -, *, /, %
Precedence, p. 33: parentheses first; then *,/, and %;
and last are + and –. All from left to right.
 endl to output a newline and flush output buffer
 << can be concatenated
Introduction to C++ Programming (Deitel)
15
1 // Fig. 2.5: fig02_05.cpp
2 // Addition program.
3 #include <iostream>
4
5 // function main begins program execution
6 int main()
7 {
8 int integer1; // first number to be input by user
9 int integer2; // second number to be input by user
10 int sum; // variable in which sum will be stored
11
12 std::cout << "Enter first integern"; // prompt
13 std::cin >> integer1; // read an integer
14
15 std::cout << "Enter second integern"; // prompt
16 std::cin >> integer2; // read an integer
17
18 sum = integer1 + integer2; // assign result to sum
19
20 std::cout << "Sum is " << sum << std::endl; // print sum
21
22 return 0; // indicate that program ended successfully
23
24 } // end function main
Declare integer variables.
Use stream extraction
operator with standard
input stream to obtain user
input.
Stream manipulator
std::endl outputs a
newline, then “flushes
output buffer.”
Concatenating, chaining or
cascading stream insertion
operations.
Calculations can be performed in output statements:
alternative for lines 18 and 20:
std::cout << "Sum is " << integer1 + integer2 << std::endl;
16
Equality Operators and
Relational Operators
 Page 53, Fig. 2.13
 C++ features
 if
 equality operator == (don’t confuse with = )
 operator !=
 operator <
 operator >
 operator <=
 operator >=
Introduction to C++ Programming (Deitel)
What is Object Oriented Programming?
 OOP is a programming paradigm or
programming style centered around objects
rather than functions.
 This style of programming is not new but is
followed since 1970s.
 Object Oriented Programming is not a
programming language or a tool, but it is a
framework, a style, a way of doing programming
 There are many languages which support OOP
framework
17
Languages
 C++
 C#
 JAVA
 Ruby
 Python
 JavaScript
 And many more
18
 Many of the new frameworks that are
introduced recently in the market and are used
in web development like Object Oriented PHP
and Angular are designed using OOPs
programming concepts
 OOPs concepts are very Important for a serious
programmer who want to be a developer or a
successful software engineer in the market
19
Four main pillars of Object Oriented programming
20
Encapsulation
 Look first into the procedural programming
21
f() x,y
f() x,y,z
f() w,x,y,z
Program
Encapsulation
 This problem of interdependency of functions in
procedural programing is now solved in OOPs
22
f() x
f() x
Property
Method
23
Procedural programming example
 float wage(float bS,int ot,float rate)
 {
 return bS + ot*rate;
 }
 int main(int argc, char** argv) {

 float baseSalary=20000, rate=20;
 int overtime = 10;
 float netSalary;
 netSalary = wage(baseSalary,overtime,rate)
 return 0;
 } 24
Solve the same problem using OOP
 class employee
 {
 private:
 float baseSalary=10
 int overTime=20;
 float rate=30;
 public:
 float wage()
 {
 return (baseSalary + overTime*rate);
 }
 };
 int main(int argc, char** argv) {

 employee e1;
 cout<<e1.wage();
 return 0;
 } 25
Encapsulation
- process of binding data members
(variables, properties) and member
functions (methods) together.
- Providing different levels of scope on
how classes, methods, and attributes can
be accessed and only allowing access on
a need-to-know basis. Generally, oop
uses private, public and protected
keywords to implement encapsulation on
attributes, methods and classes. For
example, a private method in a class
could only be accessed by the class and
a public method could be accessed any
other class.
Abstraction
 Abstraction is the process of showing only
essential/necessary features of an entity/object
to the outside world and hide the other
irrelevant information.
26
Simpler Interface
Reduce the
impact of change
Inheritance
 The mechanism which allows you to eliminate
the redundant code
 Consider these HTML elements
27
HTML Element
Size
Color
Click()
Focus()
Polymorphism
 Poly means Many and Morph means form
 It is a technique which allows you to get rid of
long if else switch case statements.
 For example rendring HTML
element
28
HTML Element
Size
Color
Click()
Focus()
In Procedural
Language the code
for rendering these
elements will be:
switch(…){
Case ‘select’:
renderSelect();
Case ‘text’:
renderTextBox()
…
…
}
 In OOP
We implement
Render method
For each object and it
Will behave differently
For each object;
Virtual render(){}
In main it can be called like: textbox.render();
select.render(); 29
HTML Element
Size
Color
Click()
Focus()
30
 We begin our introduction to object orientation,
a natural way of thinking about the world and
writing computer programs.
 Our goal here is to help you develop an object-
oriented way of thinking and to introduce you to
the Unified Modeling Language™ (UML™)a
graphical language that allows people who
design object-oriented software systems to use
an industry-standard notation to represent
them.
31
 analyze a typical requirements document that
describes a software system (the ATM) to be
built
 determine the objects required to implement
that system
 determine the attributes the objects will have
 determine the behaviors these objects will
exhibit
 specify how the objects interact with one
another to meet the system requirements
32
 Let's begin with a simple analogy to help you reinforce your understanding of
classes and their contents.
 Suppose you want to drive a car and make it go faster by pressing down on its
accelerator pedal.
 What must happen before you can do this?
 Well, before you can drive a car, someone has to design it and build it.
 A car typically begins as engineering drawings, similar to the blueprints used to
design a house.
 These drawings include the design for an accelerator pedal that the driver will
use to make the car go faster.
 In a sense, the pedal "hides" the complex mechanisms that actually make the
car go faster, just as the brake pedal "hides" the mechanisms that slow the car,
the steering wheel "hides" the mechanisms that turn the car and so on.
 This enables people with little or no knowledge of how cars are engineered to
drive a car easily, simply by using the accelerator pedal, the brake pedal, the
steering wheel, the transmission shifting mechanism and other such simple
and user-friendly "interfaces" to the car's complex internal mechanisms. 33

More Related Content

PDF
T2
PDF
1 puc programming using c++
PPTX
object oriented programming language in c++
PPTX
Advantage and Disadvantages of C++ programming.pptx
PPTX
Programming in c++
PPTX
Programming in c++
DOCX
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
PPTX
Principles of object oriented programing
T2
1 puc programming using c++
object oriented programming language in c++
Advantage and Disadvantages of C++ programming.pptx
Programming in c++
Programming in c++
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Principles of object oriented programing

Similar to Object Oriented Programming Lecture 01.pptx (20)

PDF
C++programing
PDF
C++programing
PDF
PPTX
Introduction to c++ programming language
PPT
Intro. to prog. c++
PPTX
C++Basics2022.pptx
PDF
Introduction-to-C-Part-1.pdf
PPTX
1. Introduction to C++ and brief history
PPTX
Lab 1.pptx
DOCX
LECTURE NOTES ON Object Oriented Programming Using C++
PPT
Topic 1 PBO
PDF
Deepakkumarassignmentnumberdiles1 01.pdf
PPTX
C++ helps you to format the I/O operations like determining the number of dig...
PDF
Oops concepts in c++ documentation
PPTX
Interoduction to c++
PDF
Oops index
PPTX
Object Oriented Programming using C++ - OOPS concepts using C++ programming l...
PPT
Programming of c++
PDF
PPTX
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++programing
C++programing
Introduction to c++ programming language
Intro. to prog. c++
C++Basics2022.pptx
Introduction-to-C-Part-1.pdf
1. Introduction to C++ and brief history
Lab 1.pptx
LECTURE NOTES ON Object Oriented Programming Using C++
Topic 1 PBO
Deepakkumarassignmentnumberdiles1 01.pdf
C++ helps you to format the I/O operations like determining the number of dig...
Oops concepts in c++ documentation
Interoduction to c++
Oops index
Object Oriented Programming using C++ - OOPS concepts using C++ programming l...
Programming of c++
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
Ad

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
01-Introduction-to-Information-Management.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
master seminar digital applications in india
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Sports Quiz easy sports quiz sports quiz
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
RMMM.pdf make it easy to upload and study
Renaissance Architecture: A Journey from Faith to Humanism
Microbial disease of the cardiovascular and lymphatic systems
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
01-Introduction-to-Information-Management.pdf
Complications of Minimal Access Surgery at WLH
Abdominal Access Techniques with Prof. Dr. R K Mishra
O5-L3 Freight Transport Ops (International) V1.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
O7-L3 Supply Chain Operations - ICLT Program
master seminar digital applications in india
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Sports Quiz easy sports quiz sports quiz
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Ad

Object Oriented Programming Lecture 01.pptx

  • 1. Object Oriented Programming Objects and Classes Dr. Khalil Ullah Department of Software Engineering khalil.ullah@uom.edu.pk University of Malkand Bridging the gap between inspiration and aspiration 1 Class Object
  • 2. 2 Welcome  Object-Oriented Programming  Mon. Tue. Wed., 9:00–10:00 a.m.  Instructor: Dr. Khalil Ullah  Email – Khalil.ullah@uom.edu.pk  Office hours – Thu. and Fri. 9:30–11:00 am.  Contact No. 03480916815.
  • 3. 3 Required Textbook H. M. Deitel and P. J. Deitel, C++ How to Program, Fifth Edition. Upper Saddle River, NJ: Prentice Hall, 2005. ISBN 0-13-185757-6 Textbook web page: http://www.deitel.com/books/cppHTP5/index.html A recommended book (not required): Ann R. Ford and Toby J. Teorey, Practical Debugging in C++. Upper Saddle River, NJ: Prentice Hall, 2002. ISBN 0-13-065394-2 Object Oriented Programming by Robert Lafore Course Introduction
  • 4. 4 How to Succeed  Read the chapter before class  Participate  In class and in the discussions  Learn object-oriented programming by writing a lot of small programs  To learn C++ programming skills  To apply those skills in problem solving  Start the assignments early  Invest time and work hard! Course Introduction
  • 6. 6 Historical Perspective  1968 – The “software crisis”  NATO Software Engineering Conference in Garmisch, Germany  Late projects, high costs, code was hard to maintain  Ad hoc programming  Structured programming  Adapted in the late 1960s to produce programs that were easy to understand, develop, test, and modify C++ and Object-Oriented Programming (Deitel; Randell; Wirth)
  • 7. 7 Structured Programming  Programs should be composed of pieces that have only one starting point and one terminating point  Use only three kinds of “pieces” 1. Sequence 2. Selection control structures  e.g., if, if/else, switch 3. Repetition control structures  e.g., while, do/while, for C++ and Object-Oriented Programming (Deitel; Wirth)
  • 8. 8 Object-Oriented Programming  Became widely used in the 1990s  Provided the foundation for real progress in creating software that is easy to understand, develop, test, and modify  A way of solving a problem by writing a program that models the elements in the problem space as objects  For example, a program used to support a video rental business would have objects such as a store, videos, and customers  Programs are collections of objects  Each object can provide a set of services  Objects interact by sending messages telling each other what to do C++ and Object-Oriented Programming (Deitel; Eckel)
  • 9. 9 Object-Oriented Programming  Some advantages  Easy to understand and develop because the objects directly model real-world elements  Faster development  Easier to maintain  Object-oriented software is easier to reuse  Object-based programming  Class – program element that contains both data and the functions that manipulate it  Object –instance of a class (like a “variable”)  Object-oriented programming  Inheritance  Polymorphism C++ and Object-Oriented Programming (Deitel)
  • 10. 10 Brief Facts About C++  Evolved from C  Designed and implemented by Bjarne Stroustrup at the Bell Labs in the early 1980s  “C with classes”  Standardized by ISO in 1997  Includes the C++ standard library  Standard Template Library (STL)  Part of the C++ standard library  Readymade classes for data structures and algorithms C++ and Object-Oriented Programming (Deitel; Josuttis)
  • 11. 11 INTRODUCTION TO C++ PROGRAMMING C++ Features in Chapter 1
  • 12. 12 A Simple Example  Page 42, Fig. 2.4  C++ features  Comments  Include directive  main()  Statements end with semicolons ;  cout and << for output  std namespace  Escape characters, e.g. n Introduction to C++ Programming (Deitel)
  • 13. 13 1 // Fig. 2.4: fig02_04.cpp 2 // A first program in C++. 3 #include <iostream> 4 5 // function main begins program execution 6 int main() 7 { 8 std::cout << "Welcome to C++!n"; 9 10 return 0; // indicate that program ended successfully 11 12 } // end function main Welcome to C++! Single-line comments. Preprocessor directive to include input/output stream header file <iostream>. Function main appears exactly once in every C++ program.. Function main returns an integer value. Left brace { begins function body. Corresponding right brace } ends function body. Statements end with a semicolon ;. Name cout belongs to namespace std. Stream insertion operator. Keyword return is one of several means to exit function; value 0 indicates program terminated successfully.
  • 14. 14 Another Example  Page 43, Fig. 2.5  C++ features  Declaring variables  Input using cin and >>  C++ supports many arithmetic operators +, -, *, /, % Precedence, p. 33: parentheses first; then *,/, and %; and last are + and –. All from left to right.  endl to output a newline and flush output buffer  << can be concatenated Introduction to C++ Programming (Deitel)
  • 15. 15 1 // Fig. 2.5: fig02_05.cpp 2 // Addition program. 3 #include <iostream> 4 5 // function main begins program execution 6 int main() 7 { 8 int integer1; // first number to be input by user 9 int integer2; // second number to be input by user 10 int sum; // variable in which sum will be stored 11 12 std::cout << "Enter first integern"; // prompt 13 std::cin >> integer1; // read an integer 14 15 std::cout << "Enter second integern"; // prompt 16 std::cin >> integer2; // read an integer 17 18 sum = integer1 + integer2; // assign result to sum 19 20 std::cout << "Sum is " << sum << std::endl; // print sum 21 22 return 0; // indicate that program ended successfully 23 24 } // end function main Declare integer variables. Use stream extraction operator with standard input stream to obtain user input. Stream manipulator std::endl outputs a newline, then “flushes output buffer.” Concatenating, chaining or cascading stream insertion operations. Calculations can be performed in output statements: alternative for lines 18 and 20: std::cout << "Sum is " << integer1 + integer2 << std::endl;
  • 16. 16 Equality Operators and Relational Operators  Page 53, Fig. 2.13  C++ features  if  equality operator == (don’t confuse with = )  operator !=  operator <  operator >  operator <=  operator >= Introduction to C++ Programming (Deitel)
  • 17. What is Object Oriented Programming?  OOP is a programming paradigm or programming style centered around objects rather than functions.  This style of programming is not new but is followed since 1970s.  Object Oriented Programming is not a programming language or a tool, but it is a framework, a style, a way of doing programming  There are many languages which support OOP framework 17
  • 18. Languages  C++  C#  JAVA  Ruby  Python  JavaScript  And many more 18
  • 19.  Many of the new frameworks that are introduced recently in the market and are used in web development like Object Oriented PHP and Angular are designed using OOPs programming concepts  OOPs concepts are very Important for a serious programmer who want to be a developer or a successful software engineer in the market 19
  • 20. Four main pillars of Object Oriented programming 20
  • 21. Encapsulation  Look first into the procedural programming 21 f() x,y f() x,y,z f() w,x,y,z Program
  • 22. Encapsulation  This problem of interdependency of functions in procedural programing is now solved in OOPs 22 f() x f() x Property Method
  • 23. 23
  • 24. Procedural programming example  float wage(float bS,int ot,float rate)  {  return bS + ot*rate;  }  int main(int argc, char** argv) {   float baseSalary=20000, rate=20;  int overtime = 10;  float netSalary;  netSalary = wage(baseSalary,overtime,rate)  return 0;  } 24
  • 25. Solve the same problem using OOP  class employee  {  private:  float baseSalary=10  int overTime=20;  float rate=30;  public:  float wage()  {  return (baseSalary + overTime*rate);  }  };  int main(int argc, char** argv) {   employee e1;  cout<<e1.wage();  return 0;  } 25 Encapsulation - process of binding data members (variables, properties) and member functions (methods) together. - Providing different levels of scope on how classes, methods, and attributes can be accessed and only allowing access on a need-to-know basis. Generally, oop uses private, public and protected keywords to implement encapsulation on attributes, methods and classes. For example, a private method in a class could only be accessed by the class and a public method could be accessed any other class.
  • 26. Abstraction  Abstraction is the process of showing only essential/necessary features of an entity/object to the outside world and hide the other irrelevant information. 26 Simpler Interface Reduce the impact of change
  • 27. Inheritance  The mechanism which allows you to eliminate the redundant code  Consider these HTML elements 27 HTML Element Size Color Click() Focus()
  • 28. Polymorphism  Poly means Many and Morph means form  It is a technique which allows you to get rid of long if else switch case statements.  For example rendring HTML element 28 HTML Element Size Color Click() Focus() In Procedural Language the code for rendering these elements will be: switch(…){ Case ‘select’: renderSelect(); Case ‘text’: renderTextBox() … … }
  • 29.  In OOP We implement Render method For each object and it Will behave differently For each object; Virtual render(){} In main it can be called like: textbox.render(); select.render(); 29 HTML Element Size Color Click() Focus()
  • 30. 30
  • 31.  We begin our introduction to object orientation, a natural way of thinking about the world and writing computer programs.  Our goal here is to help you develop an object- oriented way of thinking and to introduce you to the Unified Modeling Language™ (UML™)a graphical language that allows people who design object-oriented software systems to use an industry-standard notation to represent them. 31
  • 32.  analyze a typical requirements document that describes a software system (the ATM) to be built  determine the objects required to implement that system  determine the attributes the objects will have  determine the behaviors these objects will exhibit  specify how the objects interact with one another to meet the system requirements 32
  • 33.  Let's begin with a simple analogy to help you reinforce your understanding of classes and their contents.  Suppose you want to drive a car and make it go faster by pressing down on its accelerator pedal.  What must happen before you can do this?  Well, before you can drive a car, someone has to design it and build it.  A car typically begins as engineering drawings, similar to the blueprints used to design a house.  These drawings include the design for an accelerator pedal that the driver will use to make the car go faster.  In a sense, the pedal "hides" the complex mechanisms that actually make the car go faster, just as the brake pedal "hides" the mechanisms that slow the car, the steering wheel "hides" the mechanisms that turn the car and so on.  This enables people with little or no knowledge of how cars are engineered to drive a car easily, simply by using the accelerator pedal, the brake pedal, the steering wheel, the transmission shifting mechanism and other such simple and user-friendly "interfaces" to the car's complex internal mechanisms. 33