C++ LANGUAGE
• INTRODUCTION:
C++ is an object-oriented programming language; it was developed by
Bjarne Stroustrup at "AT&T" bell laboratories in the early of 1980's.
• Heritage of C++ :
In C++, the features of C and Simula 67 are combined. Therefore, C++
is an extension of C with a major addition of the class construct feature
of "Simula 67". Since the class was major addition to the original major C
language, it is called as "C with classes". However later in 1983, the
name was changed to C++. The idea of C++ comes from the 'C'
increment operator "++", there by suggesting that C++ is an
incremented version of 'C'.
• Object Oriented Program :
It is methodology or technology to write a program. If any language
supports the features of object-oriented programming, then that language
is called as 'Object Oriented Programming' language.
• Features of Object-oriented programming :
1. Objects
2. Classes
3. Encapsulation
4. Abstraction
5. Inheritance
6. Polymorphism
7. Message Communication
• Objects :
,Object is a run time entity which is an instance of class. Object consists of
some properties and some behaviors. Properties are represented by
variables and behaviors are represented by functions.
Example: - dog
properties:- color,weight,height,length
behaviors:- run(), eat(), bark (), sleep()
• Class:
Class is a data type (user defined) to declare an object. Class is a model
or blue print or imagination to represent the object. Class also consists of
some properties and some behaviors. properties are represented by
variables, and actions (behaviors) are represented by functions.
Example: - Animal
properties: - color,weight,length,height
behavior's: - run(), sleep(), breath(), eat()
Note: -
Class doesn't exist physically but Object exists physically.
Without Class Object doesn't exist. but without object Class can exist.
Class Object
----------------------------
Animal dog, cat, horse
Flower rose, lily
, • Encapsulation:
Binding or wrapping of data and its functionality inside single unit (class)
is called as Encapsulation.
• Abstraction:
Abstraction is the process of hiding the details and exposing only the
essential features of a particular concept or object.
• Inheritance :
1. Inheritance is the capability of a class to use the properties and
methods of another class while adding its own functionality.
2. Inheritance supports the concept of hierarchical classification.
3. In OOP, the concept of inheritance provides the idea of reusability.
• Polymorphism :
Poly -> many
Morphism -> forms
It is an ability to take more than one form. It places an important role on
allowing objects having different internal structures to show the same
external interface.
• Dynamic Binding :
Dynamic binding means that the code associated with a given procedure
call is not known until the time of the call at the runtime.
Differences between C and C++
, C C++
It is a procedure-oriented It is an Object-Oriented Programming
programming language language.
In procedure oriented, programs In Object Oriented Programs are
are divided into individual divided into objects.
procedures that do different tasks.
Data can be hidden and cannot be
Data can be accessed anywhere. accessed by outside functions.
It is bottom-up approach.
It is top-down approach.
Data and associated operations are
Procedures are independent of combined into a single unit.
each other.
It is easy to use and easy to maintain.
In procedure oriented,
maintenance of a large software
system is risky and costly.
• I/O Stream :
Continuous flow of bytes is called a stream. Streams are classified into
two types.
• Output streams
• Input streams
❖ Output stream:
• INTRODUCTION:
C++ is an object-oriented programming language; it was developed by
Bjarne Stroustrup at "AT&T" bell laboratories in the early of 1980's.
• Heritage of C++ :
In C++, the features of C and Simula 67 are combined. Therefore, C++
is an extension of C with a major addition of the class construct feature
of "Simula 67". Since the class was major addition to the original major C
language, it is called as "C with classes". However later in 1983, the
name was changed to C++. The idea of C++ comes from the 'C'
increment operator "++", there by suggesting that C++ is an
incremented version of 'C'.
• Object Oriented Program :
It is methodology or technology to write a program. If any language
supports the features of object-oriented programming, then that language
is called as 'Object Oriented Programming' language.
• Features of Object-oriented programming :
1. Objects
2. Classes
3. Encapsulation
4. Abstraction
5. Inheritance
6. Polymorphism
7. Message Communication
• Objects :
,Object is a run time entity which is an instance of class. Object consists of
some properties and some behaviors. Properties are represented by
variables and behaviors are represented by functions.
Example: - dog
properties:- color,weight,height,length
behaviors:- run(), eat(), bark (), sleep()
• Class:
Class is a data type (user defined) to declare an object. Class is a model
or blue print or imagination to represent the object. Class also consists of
some properties and some behaviors. properties are represented by
variables, and actions (behaviors) are represented by functions.
Example: - Animal
properties: - color,weight,length,height
behavior's: - run(), sleep(), breath(), eat()
Note: -
Class doesn't exist physically but Object exists physically.
Without Class Object doesn't exist. but without object Class can exist.
Class Object
----------------------------
Animal dog, cat, horse
Flower rose, lily
, • Encapsulation:
Binding or wrapping of data and its functionality inside single unit (class)
is called as Encapsulation.
• Abstraction:
Abstraction is the process of hiding the details and exposing only the
essential features of a particular concept or object.
• Inheritance :
1. Inheritance is the capability of a class to use the properties and
methods of another class while adding its own functionality.
2. Inheritance supports the concept of hierarchical classification.
3. In OOP, the concept of inheritance provides the idea of reusability.
• Polymorphism :
Poly -> many
Morphism -> forms
It is an ability to take more than one form. It places an important role on
allowing objects having different internal structures to show the same
external interface.
• Dynamic Binding :
Dynamic binding means that the code associated with a given procedure
call is not known until the time of the call at the runtime.
Differences between C and C++
, C C++
It is a procedure-oriented It is an Object-Oriented Programming
programming language language.
In procedure oriented, programs In Object Oriented Programs are
are divided into individual divided into objects.
procedures that do different tasks.
Data can be hidden and cannot be
Data can be accessed anywhere. accessed by outside functions.
It is bottom-up approach.
It is top-down approach.
Data and associated operations are
Procedures are independent of combined into a single unit.
each other.
It is easy to use and easy to maintain.
In procedure oriented,
maintenance of a large software
system is risky and costly.
• I/O Stream :
Continuous flow of bytes is called a stream. Streams are classified into
two types.
• Output streams
• Input streams
❖ Output stream: