Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

TITLE

PRESENTATION OF C++

AUTHER
GIRDHARI LAL CHOUDHARY
BRANCH- COMPUTER SCIENCE
COLLEGE ID-12CS025
COLLEGE-GOVT. ENGINEERING COLLEGE, AJMER

CONTAINT:

Object
Class
Class data member
Difference between structure &
class
Specifier
1.private
2.public
3.protacted

CONTAINT:

Constructor
Destructor
Friend function
This pointer
New & Delete operators
Static class member

CONTAINT: Features of object oriented


programming language:1. Encapsulation
2. Inheritance
3. polymorphism

OBJECT: It is a user define data type. It is


derive from structure.
Object is an instance of class.
Here instance means image or
copy. So we can say object is a
physical image of class while
class is logical.
For example is fruit is class &
apple is object.

CLASS: It is also user define data type. It


is derive from structure.
Class is the collection of method
& properties. Here method
means function & properties
means variables.
Class is the logical entity.

CLASS DATA MEMBER: The scope of the class members


by defaults are private.

DIFFERENCE BETWEEN CLASS &


STRUCTURE: The basic difference between
class and object we declare a
variable of structure type where
as we create an object of class
type.
In structure we cannot use the
access specifier like public,
private, protected but in class
we can usage.
The scope of the structure by

SPECIFIER:1. PUBLIC:It will define the class


member within a public section or
publicly then it means it can be excess
any be where in the program and in
other program also.
2. PRIVATE:It will define any class
member as private then it means it can
excess only in a class or in same class

3. PROTECTED:If any class


member as protected then it
means it can be excess in same
class and it can also excess in
child classes of that class but not
in other class.

CONSTRUCTOR: It is a special method of a class.


It is a special because it call
automatically when any object of the
class is created.
The constructor method is called by
an operating system.
C++ has its own constructor that is
called default constructor which is
called when we does not create any
constructor method into a class.

The default constructor is mainly


used for initialize an object into
a memory.

Rules of constructor: The constructor name and the class


name must be same.
Constructor is the method but it has
no return type.
It should be public but we can also
create the private constructor but in
that class.
One constructor can be called by single
object at a time. It means by one object
we can call one constructor at a time.

Types of constructor:Mainly constructor is divided into


two main categories:1. Parameterize
constructor
2. Non parameterize
constructor
1.Parameterize constructor:In this type of
constructor we can pass the
parameter threw constructor

2. Non parameterize
constructor :It is also
called the default constructor. In
this type of constructor we cannot
pass of parameter an object.

DESTRUCTOR: It is also a special method of a class like


constructor. It is automatically remove
when program is terminated or end.
It is used for destroy the object which is
initialize by constructor.
The class name and the destructor name
must be same but with destructor ~ tiled
sign.
The overloading of destructor cannot be
possible means we cannot create more
then one destructor method into a class.

Destructor cannot be
parameterized. It is always non
parameterized.
C++ has its default destructor
also which is called when there
is destructor method defined in
class.
We defined own destructor
because we allocate the run time
memory like in case of dynamic
constructor then we have to
create own destructor which can
automatically allocated the

ENCAPSULATION: It is one of the important feature


of object oriented programming
language.
Encapsulation means to wrap or
bind the data and function into
a single unit that is called class.
Encapsulation provides the
security of data.
We can implement the concept
of encapsulation by class and

INHERITANCE: It is also important feature of object


oriented programming language.
It is the concept of reusability means
once we create a class then we can use
it multiple times according to our
requirement. In other words we can say
that we can create or built a new class
by inherit by the features of classes.
The main advantages of inheritance is
reduce the complexity of code.

TYPES OF INHERITANCE:

1. Single level inheritance


2. Multilevel inheritance
3 Multiple inheritance
4. Hierarchical inheritance
5. Hybrid inheritance

1. Single level inheritance:In this type


of inheritance there is only two
class:(1) Base class
(2) Derived class
(base)

(child) B

2. Multilevel inheritance:
In this inheritance
one class can be as child class but
it is one class can have only single
child and single parent at a time.
A
B
C

3. Multiple inheritance:one class can have


multiple parent at a time but it is
not that parent class has only
single child class at a time.
A AAA
C

4. Hierarchical inheritance:One class can have


multiple child at a time but it is
not that child class has only a
single parent at a time.
A

5. Hybrid inheritance:It is also called


multipath inheritance because we
can access the features of one
class in multiple classes called
hybrid because it is a combo of
two or more types of inheritance.
A
B

C
D

POLYMORPHISM: It is one of the important feature


of objected oriented
programming language.
It is Greek word which is derive
from two words the first is poly
which means many and the
second is morphism which means
forms. So we can say
polymorphism means many form
of an object.

TYPES OF
POLYMORPHISM: It has two types:1. compile time
polymorphism
2. run time polymorphism

Polymorphism

Compile time
Run time

Function
Operator
Pure Virtual
Overloading
Overloading
function
function

Virtual

1.Compile time polymorphism:It is also called


static binding or early binding
because at compile time only it is
decided that which specific
method or a function called.
It is increment by two ways:(1) function overloading
(2) operator
overloading

2. Run time polymorphism:It which at a run time it


is that which specific method of
which class is called.
-> Run time polymorphism can be
implement only in case of
inheritance.
-> It is also called dynamic binding
or late binding.
-> we can implement the run time
polymorphism by two ways:(1) Virtual function
(2) Pure virtual function

THANK YOU
SUBIMITTED TO
DEELIP SIR

You might also like