Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Chapter 1: INTRODUCTION
to Object Oriented Programming in C++
Minh Quang Nguyen
Hanoi National University of Education
September 2015
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
State of the Arts
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Procedure oriented programming language
Programs written by procedure oriented programming languages
contain sequences of statements to ask/command computers to
perform a particular mission
I
Programs are divided into functions.
Each function is responsible for a specific purpose. Each
function has a clear interface. (What is function interface? )
Several functions can be grouped into modules of components.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Procedure oriented programming language
Programs written by procedure oriented programming languages
contain sequences of statements to ask/command computers to
perform a particular mission
I
Programs are divided into functions.
Each function is responsible for a specific purpose. Each
function has a clear interface. (What is function interface? )
Several functions can be grouped into modules of components.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Procedure oriented programming language
Programs written by procedure oriented programming languages
contain sequences of statements to ask/command computers to
perform a particular mission
I
Programs are divided into functions.
Each function is responsible for a specific purpose. Each
function has a clear interface. (What is function interface? )
Several functions can be grouped into modules of components.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Procedure oriented programming language
Programs written by procedure oriented programming languages
contain sequences of statements to ask/command computers to
perform a particular mission
I
Programs are divided into functions.
Each function is responsible for a specific purpose. Each
function has a clear interface. (What is function interface? )
Several functions can be grouped into modules of components.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Disadvantages
Some disadvantages of procedure oriented programming languages
I
Global variables can be accessed by functions.
Data and functions are loosely connected.
Complicated data types is difficult to build.
Example:
I
I
a Point in a plane with 2 coordinates x, y
It is hard to perform operations in this data type with
procedure oriented programming languages only.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Disadvantages
Some disadvantages of procedure oriented programming languages
I
Global variables can be accessed by functions.
Data and functions are loosely connected.
Complicated data types is difficult to build.
Example:
I
I
a Point in a plane with 2 coordinates x, y
It is hard to perform operations in this data type with
procedure oriented programming languages only.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Disadvantages
Some disadvantages of procedure oriented programming languages
I
Global variables can be accessed by functions.
Data and functions are loosely connected.
Complicated data types is difficult to build.
Example:
I
I
a Point in a plane with 2 coordinates x, y
It is hard to perform operations in this data type with
procedure oriented programming languages only.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Disadvantages
Some disadvantages of procedure oriented programming languages
I
Global variables can be accessed by functions.
Data and functions are loosely connected.
Complicated data types is difficult to build.
Example:
I
I
a Point in a plane with 2 coordinates x, y
It is hard to perform operations in this data type with
procedure oriented programming languages only.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Object oriented programming languages in a nutshell
Object oriented programming languages combine DATA and
FUNCTIONs (which perform on these data) into joint concept:
OBJECTs.
I
Functions in an object - function members, provide the
methods to access the DATAs and perform their function.
Data in an object - data member, is so-called attribute or
instance variable. They help to describe the charateristics of
the object.
Calling a function member in an object is considered as
sending a message to this object.
In a program written by C++, objects are communicate each other
by sending their appropriate messages.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Object oriented programming languages in a nutshell
Object oriented programming languages combine DATA and
FUNCTIONs (which perform on these data) into joint concept:
OBJECTs.
I
Functions in an object - function members, provide the
methods to access the DATAs and perform their function.
Data in an object - data member, is so-called attribute or
instance variable. They help to describe the charateristics of
the object.
Calling a function member in an object is considered as
sending a message to this object.
In a program written by C++, objects are communicate each other
by sending their appropriate messages.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Object oriented programming languages in a nutshell
Object oriented programming languages combine DATA and
FUNCTIONs (which perform on these data) into joint concept:
OBJECTs.
I
Functions in an object - function members, provide the
methods to access the DATAs and perform their function.
Data in an object - data member, is so-called attribute or
instance variable. They help to describe the charateristics of
the object.
Calling a function member in an object is considered as
sending a message to this object.
In a program written by C++, objects are communicate each other
by sending their appropriate messages.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Object oriented programming languages in a nutshell
Object oriented programming languages combine DATA and
FUNCTIONs (which perform on these data) into joint concept:
OBJECTs.
I
Functions in an object - function members, provide the
methods to access the DATAs and perform their function.
Data in an object - data member, is so-called attribute or
instance variable. They help to describe the charateristics of
the object.
Calling a function member in an object is considered as
sending a message to this object.
In a program written by C++, objects are communicate each other
by sending their appropriate messages.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Object oriented programming languages in a nutshell
Object oriented programming languages combine DATA and
FUNCTIONs (which perform on these data) into joint concept:
OBJECTs.
I
Functions in an object - function members, provide the
methods to access the DATAs and perform their function.
Data in an object - data member, is so-called attribute or
instance variable. They help to describe the charateristics of
the object.
Calling a function member in an object is considered as
sending a message to this object.
In a program written by C++, objects are communicate each other
by sending their appropriate messages.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Features
In OPP, we only use objects to model the problem. Objects is
members of a class. Class describes the objects which share the
same features.
I
Inheritance: a class can be inherited from other classes.
Override.
Virtual method.
OPP allows us to create new data types and execute them easily.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Features
In OPP, we only use objects to model the problem. Objects is
members of a class. Class describes the objects which share the
same features.
I
Inheritance: a class can be inherited from other classes.
Override.
Virtual method.
OPP allows us to create new data types and execute them easily.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Features
In OPP, we only use objects to model the problem. Objects is
members of a class. Class describes the objects which share the
same features.
I
Inheritance: a class can be inherited from other classes.
Override.
Virtual method.
OPP allows us to create new data types and execute them easily.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
Why OPP is important?
Features
In OPP, we only use objects to model the problem. Objects is
members of a class. Class describes the objects which share the
same features.
I
Inheritance: a class can be inherited from other classes.
Override.
Virtual method.
OPP allows us to create new data types and execute them easily.
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
C/C++
Why is C?
Developed at Bell lab.
Developed from B. Most of statement and rules of C can be
applied in C. C++ has some additional features:
I
Class
Object
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
IDE?
Chapter 1: INTRODUCTION to Object Oriented Programming in C++
State of the Arts
Q&A
THANK YOU FOR YOUR ATTENTION!