Beruflich Dokumente
Kultur Dokumente
OBJECT ORIENTED
PROGRAMMING IN C++
C++
C++ is an Object Oriented Programming
language.
Developed by Bjarne Stroustrup
Created at Bell Labs in the 1980's and called C
with Classes
A superset of C
Adds additional features to improve the language
Adds functions and features to support Object
Oriented Programming (OOP)
1.3
Introduction to C++
Where did C++ come from?
Derived from the C language
C was derived from the B language
B was derived from the BCPL language
Variables
Comment
cin >> x;
“>>” points from the keyboard to a variable where the data is stored
Basic concepts of OOPs
Objects
Classes
Inheritance
Polymorphism
Dynamic binding
Message Passing
Object X Object Y
Dynamic Binding
Binding means linking a function to be executed
in response to the function call.
Also called as late binding.
The code associated with a given function call is
not known until the time of execution of the
function (run time)
Message Passing
Objects communicate with each other as follows:
By creating classes and defining the objects
By creating objects of the type of class
Include files
Class declaration
Member functions
definitions
Main function Program
Introducing C++ Classes
In C++, to create an object, you first must
define its general form by using the keyword
class.
A class is similar syntactically to a
structure.