You are on page 1of 18

Introduction to C++

 C++ is a popular programming language


 C++ is used to create computer programs

Dr Yasir Iqbal Mir | CAP202


WHAT IS C++

Dr Yasir Iqbal Mir | CAP202


 C++ is an object-oriented programming language. It
is an extension to C programming.
 C++ is a general purpose, case-sensitive, free-form
programming language that supports object-
oriented, procedural and generic programming.
 C++ is a cross-platform language that can be used
to create high-performance applications.
 C++ gives programmers a high level of control over
system resources and memory.
WHY TO USE C++

Dr Yasir Iqbal Mir | CAP202


 C++ is one of the world's most popular
programming languages.
 C++ can be found in today's operating systems,
Graphical User Interfaces, and embedded systems
 C++ is an object-oriented programming language
which gives a clear structure to programs and
allows code to be reused, lowering development
costs.
 C++ is portable and can be used to develop
applications that can be adapted to multiple
platforms.
Object-Oriented
Programming (OOPs)

Dr Yasir Iqbal Mir | CAP202


 C++ was developed by Bjarne Stroustrup, as an
extension to the C language.
 C++ supports the object-oriented programming,
the four major pillar of object-oriented
programming (OOPs) used in C++ are:

1. Inheritance
2. Polymorphism
3. Encapsulation
4. Abstraction
Applications of C++
Programming

Dr Yasir Iqbal Mir | CAP202


 Application Software Development
 Programming Languages Development
 Computation Programming
 Games Development
Procedural
Programming

Dr Yasir Iqbal Mir | CAP202


 Procedural Programming can be defined as a
programming model which is derived from
structured programming, based upon the concept
of calling procedure.
 Procedures, also known as routines, subroutines
or functions, simply consist of a series of
computational steps to be carried out.
 During a program’s execution, any given
procedure might be called at any point, including
by other procedures or itself.
Object Oriented
Programming

Dr Yasir Iqbal Mir | CAP202


 Object oriented programming can be defined as a
programming model which is based upon the
concept of objects.
 Objects contain data in the form of attributes and
code in the form of methods.
 In object oriented programming, computer
programs are designed using the concept of
objects that interact with real world.
 Object oriented programming languages are
various but the most popular ones are class-
based, meaning that objects are instances of
classes, which also determine their types.
Object Oriented
Programming
VS
Procedural
Programming
Dr Yasir Iqbal Mir | CAP202
Key Object Oriented Programming (OOP) Procedural Oriented Programming (POP)

Object-oriented Programming is a programming On other hand Procedural Oriented Programming is


language that uses classes and objects to a programming language that follows a step-by-
create models based on the real world step approach to break down a task into a
Definition environment. In OOPs it makes it easy to collection of variables and routines (or subroutines)
maintain and modify existing code as new through a sequence of instructions. Each step is
objects are created inheriting characteristics carried out in order in a systematic manner so that
from existing ones. a computer can understand what to do.

In OOPs concept of objects and classes is On other hand in case of POP the the main
introduced and hence the program is divided program is divided into small parts based on the
Approach
into small chunks called objects which are functions and is treated as separate program for
instances of classes. individual smaller program.
Access In OOPs access modifiers are introduced On other hand no such modifiers are introduced in
modifiers namely as public, private and protected POP.

Due to abstraction in OOPs data hiding is On other hand POP is less secure as compare to
Security
possible and hence it is more secure than POP. OOPs.

Due to modularity, programs are less complex


On other hand there is no simple process to add
and hence new data objects can be created
Complexity data in POP at least not without revising the whole
easily from existing objects making object-
program
oriented programs easy to modify
C VS C++

Dr Yasir Iqbal Mir | CAP202


S.No C C++
C++ is multi-paradigm. It supports both procedural
1 C follows the procedural style programming.
and object oriented.
In C++, you can use modifiers for class members to
2 Data is less secured in C.
make it inaccessible for outside users.
3 C follows the top-down approach. C++ follows the bottom-up approach.
4 C does not support function overloading. C++ supports function overloading.
5 In C, you can't use functions in structure. In C++, you can use functions in structure.
6 C does not support reference variables. C++ supports reference variables.
In C, scanf() and printf() are mainly used for C++ mainly uses stream cin and cout to perform
7
input/output. input and output operations.
8 Operator overloading is not possible in C. Operator overloading is possible in C++.
C programs are divided into procedures and C++ programs are divided into functions and
9
modules classes.
10 C does not provide the feature of namespace. C++ supports the feature of namespace.
Exception handling is not easy in C. It has to C++ provides exception handling using Try and
11
perform using other functions. Catch block.

12 C does not support the inheritance. C++ supports inheritance.


end

You might also like