Sie sind auf Seite 1von 21

INTRODUCTION TO C++

C++ is an Object Oriented Language


it's an extension to C
GOALS OF C++
➲System Implementation Language
➲General-Purpose programming lan-
guage
➲Development of OOP software
➲Uses C's efficiency and portability
OBJECT ORIENTED
PROGRAMMING CONCEPT
➲ Encapsulation with data hiding
➲ Type Extensibility
➲ Inheritance
➲ Polymorphism with dynamic hiding
C++ - AN OBJECT ORIENTED
APPROACH
➲ C++ is better than C.
➲ Class & Objects
➲ Encapsulation & Type extensibility
➲ Conversions, Operators
➲ Inheritance & Polymorphism
➲ Dynamic Binding
'C++' IS BETTER THAN 'C'
➲Based on 'C'
➲Highly portable
➲Translators available on many times
➲Highly compatible with existing 'C'
CLASS & OBJECTS
● A 'CLASS' is a blueprint or prototype
that defines the variables and the
methods common to all objects of a
certain kind.
● 'OBJECT' is a real life entity which
comes under a Class.
ENCAPSULATION

➲ Class construct provides


encapsulation
➲ Implementation details of specific
type. (inaccessible to client code)
➲ Externally available operations and
functions.
TYPE-EXTENSIBILITY
● Subtyping
● Composite types
● Extensible type specifications
CONVERSIONS
● An expression of a given type is
implicitly converted in the following
situations-
– The expression is used as an operand
of an arithmetic or logical operation.
– The expression will be converted to a
Boolean.
– The expression is used in a switch
statement.
OPERATORS
● Operators are used in C++ for
boolean ( logical operators) and
arithmetic operations.
● For example – &&, ||, +, -, ++, --
TYPE OF OPERATORS
● Arithmetic operators. Ex- ++, --
● Logical operators. Ex- &&, ||
● etc.
INHERITANCE MECHANISM
➲Derive new class from existing base
class
➲Reuse existing code
➲Hierarchy of types share code &
interface

TYPES OF INHERITENCE
➲Single Inheritance
➲Multiple Inheritance
➲Multilevel Inheritance
SINGLE INHERITANCE

➲ In the Single Inheritance, there is


one base class and also one child
class.
➲ For example – Credit Cards, it can
be of types like Visa, Master cards.
MULTIPLE INHERITANCE

➲ In Multiple Inheritance, there is only


one base class and can have two or
more child classes.
➲ For example – Voice mail, It has
feature of both mail & phone.
MULTILEVEL INHERITANCE

➲ When class A is derived from class


B and Class B is derived from Class
C, it is called Multilevel Inheritance.
➲ For example – Grandfather, father
and child relationship.
POLYMORPHISM
➲Capable of assuming various forms.
➲Polymorphism is extensively used in
implementing inheritance.
➲Polymorphism allows client simple in-
terface
➲This feature is used for Operator Over-
loading.
➲Operator Overloading - we define new
operations to these operators and make
them operate on different data types.
DYNAMIC BINDING
● It refers to the linking of a procedure
call to the code to be executed in
response to the call.
● Dynamic Binding means that the
code associated with a given
procedure call is not known until the
time of the call at run-time.
● It is associated with polymorphism
& inheritance.
BENEFITS OF OOP'S
● OOP's consists of a set of objects
that communicate with each other.
● Data hiding helps to build secure
programs.
● Multiple instance of an object can
co-exist without any interference.
● OOP system can be easily upgraded
from small to large systems.
CONCLUSION
● 'C++' is a language with both
functionality of 'C' and OOP's
concept. Hence C++ is the best
suitable programming language.

Thanks.

● - Shivani Rana.

Das könnte Ihnen auch gefallen