You are on page 1of 23

Presentation on By :

Chandra
Advantages of C++ Pranjal
Samiran
over any other
language…
Contents:
• Introduction to C++
• Features of C++
• Advantages of C++
• Applications of C++
• Bonus
Introduction to C++
C++ ( pronounced as “si-plas-plas”) is a general purpose programming language
created by Bjarne Stroustrup as an extension to the C language in 1985 (37 years ago).

The language evolved significantly over the years and now modern C++ has Object-Oriented,
Generic and Functional features in addition to facilities for Low-Level Memory
Manipulation

It is always implemented as a Compiled language and many vendors provide C++ compilers ,
including the Free Software Foundation, LLVM, Microsoft, Intel, Embarcadero, Oracle
and IBM. So, it is available on many platforms.

C++ was designed with systems programming and embedded, resource constrained software and
large systems in mind with performance, efficiency and flexibility of use as its design highlights.

C++ is found useful in many other contexts, with key strengths being software infrastructure and
resource-constrained application including desktop applications, video games, servers (e.g. 
e-commerce, web search, or databases), and performance-critical applications (e.g. 
telephone switches or space probes).

MAJOR IMPLEMENTATIONS:- GCC, LLVM Clang, Microsoft Visual C++,


Intel DPC++, Embarcadero C++ builder, IBM XL C++ etc…
Credits to the creator of
C++

Bjarne Stroustrup, the creator


of C++, in his AT&T New
Jersey office c. 2000

“There are only two kinds of languages: the ones people complain about
and the ones nobody uses.”

“It's easy to win forgiveness for being wrong; being right is what gets
you into real trouble.”
Object Oriented Programming

C++ is an Object-Oriented Programming Language. This


is the most important feature of C++. It can
create/destroy objects while programming. Also, It can
create blueprints with which objects can be created.
Concepts of Object-oriented programming Language:
Class
Objects
Encapsulation
Polymorphism
Inheritance*
Abstraction

*It supports multiple inheritance by default unlike java


Mid-level Language
C++ is a Mid-Level Programming Language.

It makes life easier to work in C++ as it is a mid-level language as it is closely


associated with the human-comprehensible English language .

As well as we can do both systems-programming (drivers, kernels, networking


etc.) and build large-scale user applications (Media Players, Photoshop, Game
Engines etc.)

C++ finds varied usage in applications such as:


Operating Systems & Systems Programming. e.g. Linux-based OS (Ubuntu
etc.)
Browsers (Chrome & Firefox)
Graphics & Game engines (Photoshop, Blender, Unreal-Engine)
Database Engines (MySQL, MongoDB, Redis etc.)
Cloud/Distributed Systems
Memory Management

C++ allows us to allocate the


memory of a variable or an array
in run time. This is known as 
Dynamic Memory Allocation.
In C++, the memory must be de-
allocate dynamically allocated
memory manually after it is of no
use.
The allocation and deallocation of
the memory can be done using
the new and delete operators
 respectively.
Dynamic Memory Allocation

When the program executes in the


C++ then the variables are
allocated the dynamical heap space
. Inside of the functions the
variables are allocated in the stack
space. Many times, We are not
aware in advance that how much
memory is needed to store
particular information in a defined
variable and the size of required
memory can be determined at run
time.
Multi-Threading

Multithreading is a specialized form of multitasking and


multitasking is a feature that allows your system to
execute two or more programs concurrently. In general,
there are two sorts of multitasking: 
process-based and thread-based.

Process-based multitasking handles the concurrent


execution of programs. Thread-based multitasking deals
with the multiprogramming of pieces of an equivalent
program.

A multithreaded program contains two or more parts that


will run concurrently. Each a part of such a program is
named a thread, and every thread defines a separate path
of execution.

C++ doesn’t contain any built-in support for multithreaded


applications. Instead, it gives the programmer full freedom
to implement it as he/she wants.
Portability

• Portability or platform independence


which allows the user to run the
same code on different interfaces or
operating systems
• For programmer this feature proves
to be of great convenience.

• Suppose in Linux OS we write a


program and for some reason switch
to Windows OS, we would be able to
run the same program in windows as
well without any error.
Object Oriented

In C++ the feature of object-


oriented programming which
includes concepts like classes,
polymorphism, inheritance,
encapsulation and data
abstraction that makes a
program even more reliable and
allow code reusability
Pointers

• Pointers save the memory.


• Pointers reduce the length and
complexity of a program.
• Pointers allow passing of arrays and
strings to functions more efficiently.
• Pointers make possible to return more
than one value from the function.
• Pointers increase the processing
speed.

Note: Pointers don’t work in JAVA


Multi-Paradigm

• It is a multi-paradigm
programming language.

• The term paradigm refers to the


style of programming and
includes procedure, logic and
structure.

• Generic, object-oriented and


imperative are the three
paradigms of C++.
Memory Management
• C++ programmer gives the
provision of total control over
memory management.
#code_close_to_the_metal

• An asset and a liability are the


both increases the
responsibility of the
programmer to manage
memory rather than being
managed by Garbage collector

• The GC was too busy trying to


clean up java so we don’t do
that here.
Low-Level Manipulation

• C++ is a very expressive language.

• You can come extremely close to the


machine. You run on bare metal.

• Compilers such as JAVA VM by oracle


and embedded systems are created
using C++.

• OS kernels, memory drivers, graphic


drivers are created using C++.
Standard Template Library
STL saves your time as you don’t need to implement everything from scratch and it gives you the best implementation of data structures and
algorithms.. It proves to be pretty useful during the solving of various coding questions.
STL has four components: Algorithms Containers Functions Iterators.
Algorithms
The header algorithm defines a collection of functions especially designed to be used on ranges of elements. They act on
containers and provide means for various operations for the contents of the containers.
Algorithm Sorting Searching Important STL Algorithms Useful Array algorithms Partition Operations
Numeric valarray class

Containers
Containers or container classes store objects and data. There are in total seven standard “first-class” container classes and three
container adaptor classes and only seven header files that provide access to these containers or container adaptors.
Sequence Containers: implement data structures which can be accessed in a sequential manner. vector  list  deque  arrays 
forward_list( Introduced in C++11)
Container Adaptors : provide a different interface for sequential containers. queue priority_queue  stack
Associative Containers : implement sorted data structures that can be quickly searched (O(log n) complexity). set multiset map 
multimap

Functions
The STL includes classes that overload the function call operator. Instances of such classes are called function objects or functors.
Functors allow the working of the associated function to be customized with the help of parameters to be passed.
Functors

Iterators
As the name suggests, iterators are used for working upon a sequence of values. They are the major feature that allow generality
in STL.
Iterators

Utility Library
Defined under <utility header>
Large Community Support

• C++ has a large community that


supports it by providing ready to
use libraries , template codes ,
brief lectures .

• Statistically speaking, in Stack


Overflow and Github C++ is the
most used and followed tag.
Scalability

Scalability refers to
the ability of a
program to scale,
that means the C++
program is capable
of running on a small
scale as well as a
large scale of data.
Bonus

So, The thing is nothing is perfect.


And Every thing has its own pros and cons.
But tackling the cons and make it work makes us good
programmers.

I think we should look for elegance in the applications


built, rather than in the languages themselves.

To use C++ well, you have to understand design and


programming technique.

C++ is designed to allow you to express ideas, but if


you don't have ideas or don't have any clue about how
to express them, C++ doesn't offer much help. Its just a
tool for you to make or break big stuffs.
#include <iostream>

int main(){
std::cout<<“Thanks for Being Here”<<std::endl;
}

Thanks for Being Here

You might also like