SlideShare a Scribd company logo
2
Most read
5
Most read
6
Most read
PRESENTATION
ON C++
PRESENTED BY :
PRIYANSHU JAIN
(PIET18CS111)
INTRODUCTION TO C++
 C++ Is Developed by Bjarne stroustrup in 1979 at Bell labs.
All the programs written in c language can be run in all c++
compilers.
C++ IS AN EXTENSION OR ADVANCE VERSION OF C
LANGAUGE.
C++ IS BASED ON OOPs (OBJECT ORIENTED
PROGRAMMING).
HEADER FILE DECLARATION
GLOBAL DECLARATION
CLASS DECLARATION
AND
METHOD DECLARATION SECTION
MAIN FUNCTION
METHOD DEFINITION SECTION
INPUT OUTPUT STREAMS IN C++
In c++, input and output are performed using stream. If you
want to output something, you put it into an output stream,
and when you want something to be input , you get it from an
input stream. The standard output and input streams in c++ are
called cout and cin and they use your computer‘s screen and
keyboard respectively . The code above outputs the character
string ― The best place to start is at the beginning‖ to your
screen by placing it in the output stream with insertion
operator <<, when we come to write programs that involve
input using the extraction operator >>.
The name cout is defined in the header file iostream.h . This is
a standard header file that provides the definition necessary for
you to use the standard input and output facilities in c++.
#include<iostream>
using namespace std;
int main()
{
int a;
cout<<“enter value of a”;
cin>>a;
cout<<“value of a=“<<a;
return 0;
}
 It is a way of combining data and functions into an independent entity called
class. A class is like a blueprint of object.
 A class is a user defined datatype which has data members and member functions
used to access the data members.
DECLARATION OF CLASSES
 A class can be defined by the keyword class. The format of class declaration is given
below:
Class class_name
{
private:
variable declarations
function declarations
public :
variable declarations
function declarations
};
 The variables and functions declared in a class under keyword
private are not accessible to any outside function. This feature
of class declaration is called data hiding.
 Access specifiers :
 The keywords private and public are called access specifiers. In
the absence of a specifier , all declaration defined in a class by
default private.
 Member function definition :
 The member functions can be defined inside as well as outside
the class declaration. If a member function is very small then it
can be defined inside the class itself. And if a member function is
large then it can be defined outside the class.
MEMBER FUNCTION INSIDE CLASS
DECLARATION
#include<iostream>
using namespace std;
class class _name
{
public:
Void function_name()
{
statement1;
Statement 2;
----
}
MEMBER FUNCTION OUTSIDE CLASS
DECLARATION
#include<iostream>
using namespace std;
class class_name
{
public;
Void function_name();
};
void class_name :: function_name()
{
statement1;
Statement 2;

..
}
The operator :: is known as scope resolution operator.
This is used to access member functions to their corresponding
class in following form.
Type class_name::function_name(parameter list)
{
function body
}
where :
type : is the data type of value to be returned.
class_name : is the name of the class to which the
function belongs.
function_name : is the name of the function being
declared.
parameter list : list of formal arguments.
 It is an activity of defining a new class in terms of an existing class. The
existing class is known as a base class.( i.e. super class) and the new class is
known as derived class ( ie. Sub class ) .
 In c++, a derived class can be obtained by adding some new data structures and
functions to base class. The derived class inherits the members of its base class
without the need to redefine them. The format for defining a derived class is
given below:
Class <derived class> : Visibility mode < base class>
{
..
..
};
 Where
class: is a reserved word
<derived class > : is the name of the subclass or new class being derived.
Visibility mode : is the mode of access to items from the base class.
The access mode is optional and can be either of the following type:
Private , public & protected
Accessible from /
Access mode
Base Class Derived class Outside
Public Yes Yes Yes
Protected Yes Yes No
Private Yes No No
 The action of visibility mode or access specifiers as follows:
The inheritances are classified in following categories:
Single inheritance
Hierarchical inheritance
Multilevel inheritance
Multiple inheritance
BASE
CLASS
SUB
CLASS
SINGLE INHERITANCE : In this the single derived class is present.
HIERARCHICAL INHERITANCE :
In hierarchical inheritance, using one super or
base class & multiple derived /sub classes.
SUPER
CLASS
OR BASE
CLASS
SUB
CLASS
SUB
CLASS
MULTILEVEL INHERITANCE
BASE
CLASS
SUB
CLASS/
BASE
CLASS
SUB
CLASS
 We know that a derived class with a single base class is said to form
single inheritance. The derived class can also become a base class for
some other derived class.
 This type of chain of deriving classes can go on as for as necessary.The
inheritance of this tupe is known as multilevel inheritance.
MULTIPLE INHERITANCE
 A class can inherit properties from more than one base class. this type of
inheritance is called as multiple inheritance. Please notice that this inheritance is
different from hierarchical inheritance wherein subclasses share the same base
class. It is also different from multilevel inheritance wherein a subclass is derived
from a class which itself is derived from another class and so on .
X Y
Z Object
Base class Base class
Derived class
or Sub Class
Constructors:
 A class constructor is a special member function of a class that is executed whenever
we create new objects of that class.
A constructor will have exact same name as the class and it does not have any return type
at all, not even void. Constructors can be very useful for setting initial values for certain
member variables.
 The constructor function can also be used by a programmer to initialize the internal data
members of the object. In C++ , there are three types of constructors:
1. The default constructor
2. Parameterized constructors
3. The copy constructor
Destructors :
 A destructor is a special member function of a class that is executed whenever an
object of it's class goes out of scope or whenever the delete expression is applied to a
pointer to the object of that class.
 A destructor will have exact same name as the class prefixed with a tilde (~) and it can
neither return a value nor can it take any parameters. Destructor can be very useful for
releasing resources before coming out of the program like closing files, releasing
memories etc.
C++ presentation

More Related Content

PPTX
Variables in C++, data types in c++
PPTX
C++ language basic
PPSX
C++ Programming Language
PPTX
Presentation on C++ Programming Language
PPTX
Introduction Of C++
PPT
Basics of c++ Programming Language
PPTX
Tokens in C++
Variables in C++, data types in c++
C++ language basic
C++ Programming Language
Presentation on C++ Programming Language
Introduction Of C++
Basics of c++ Programming Language
Tokens in C++

What's hot (20)

PPTX
classes and objects in C++
PPTX
Abstract class in c++
PPTX
Friend function
PPTX
C functions
PPT
Control structure C++
PPTX
Inheritance in c++
PPTX
Encapsulation C++
PPTX
Data types in c++
PPTX
Programming in C Presentation upto FILE
PPT
Basic concept of OOP's
PPT
C presentation
PPT
Operators in C++
PPTX
Pointers in c++
PPT
Class and object in C++
PPT
Operator Overloading
PPTX
Functions in c++
PDF
Constructors and destructors
PPTX
Type conversion
PPTX
Methods in java
PDF
Constructor and Destructor
classes and objects in C++
Abstract class in c++
Friend function
C functions
Control structure C++
Inheritance in c++
Encapsulation C++
Data types in c++
Programming in C Presentation upto FILE
Basic concept of OOP's
C presentation
Operators in C++
Pointers in c++
Class and object in C++
Operator Overloading
Functions in c++
Constructors and destructors
Type conversion
Methods in java
Constructor and Destructor
Ad

Similar to C++ presentation (20)

PPTX
Chapter 2 OOP using C++ (Introduction).pptx
PPT
c++ lecture 1
PPT
c++ lecture 1
PPT
c++ introduction
PPTX
asic computer is an electronic device that can receive, store, process, and o...
PPT
UNIT I (1).ppt
PPT
UNIT I (1).ppt
PPTX
C++ Presen. tation.pptx
PPTX
Lecture 4. mte 407
PPT
OOP.ppt
DOCX
OOP and C++Classes
PPTX
C++ language
PDF
Object Oriented Programming using C++ - Part 2
PDF
22 scheme OOPs with C++ BCS306B_module1.pdf
PPT
Classes and objects
PPT
Inheritance in C++.ppt
PDF
Classes
PPT
oops-1
PPT
Unit i
PPTX
Object oriented programming. (1).pptx
Chapter 2 OOP using C++ (Introduction).pptx
c++ lecture 1
c++ lecture 1
c++ introduction
asic computer is an electronic device that can receive, store, process, and o...
UNIT I (1).ppt
UNIT I (1).ppt
C++ Presen. tation.pptx
Lecture 4. mte 407
OOP.ppt
OOP and C++Classes
C++ language
Object Oriented Programming using C++ - Part 2
22 scheme OOPs with C++ BCS306B_module1.pdf
Classes and objects
Inheritance in C++.ppt
Classes
oops-1
Unit i
Object oriented programming. (1).pptx
Ad

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Operating system designcfffgfgggggggvggggggggg
PPT
Introduction Database Management System for Course Database
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
ai tools demonstartion for schools and inter college
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administraation Chapter 3
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
medical staffing services at VALiNTRY
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Internet Downloader Manager (IDM) Crack 6.42 Build 41
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Wondershare Filmora 15 Crack With Activation Key [2025
Operating system designcfffgfgggggggvggggggggg
Introduction Database Management System for Course Database
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
ai tools demonstartion for schools and inter college
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administraation Chapter 3
PTS Company Brochure 2025 (1).pdf.......
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
medical staffing services at VALiNTRY
Navsoft: AI-Powered Business Solutions & Custom Software Development
CHAPTER 2 - PM Management and IT Context
ISO 45001 Occupational Health and Safety Management System
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...

C++ presentation

  • 1. PRESENTATION ON C++ PRESENTED BY : PRIYANSHU JAIN (PIET18CS111)
  • 2. INTRODUCTION TO C++  C++ Is Developed by Bjarne stroustrup in 1979 at Bell labs. All the programs written in c language can be run in all c++ compilers. C++ IS AN EXTENSION OR ADVANCE VERSION OF C LANGAUGE. C++ IS BASED ON OOPs (OBJECT ORIENTED PROGRAMMING).
  • 3. HEADER FILE DECLARATION GLOBAL DECLARATION CLASS DECLARATION AND METHOD DECLARATION SECTION MAIN FUNCTION METHOD DEFINITION SECTION
  • 4. INPUT OUTPUT STREAMS IN C++ In c++, input and output are performed using stream. If you want to output something, you put it into an output stream, and when you want something to be input , you get it from an input stream. The standard output and input streams in c++ are called cout and cin and they use your computer‘s screen and keyboard respectively . The code above outputs the character string ― The best place to start is at the beginning‖ to your screen by placing it in the output stream with insertion operator <<, when we come to write programs that involve input using the extraction operator >>. The name cout is defined in the header file iostream.h . This is a standard header file that provides the definition necessary for you to use the standard input and output facilities in c++.
  • 5. #include<iostream> using namespace std; int main() { int a; cout<<“enter value of a”; cin>>a; cout<<“value of a=“<<a; return 0; }
  • 6.  It is a way of combining data and functions into an independent entity called class. A class is like a blueprint of object.  A class is a user defined datatype which has data members and member functions used to access the data members. DECLARATION OF CLASSES  A class can be defined by the keyword class. The format of class declaration is given below: Class class_name { private: variable declarations function declarations public : variable declarations function declarations };
  • 7.  The variables and functions declared in a class under keyword private are not accessible to any outside function. This feature of class declaration is called data hiding.  Access specifiers :  The keywords private and public are called access specifiers. In the absence of a specifier , all declaration defined in a class by default private.  Member function definition :  The member functions can be defined inside as well as outside the class declaration. If a member function is very small then it can be defined inside the class itself. And if a member function is large then it can be defined outside the class.
  • 8. MEMBER FUNCTION INSIDE CLASS DECLARATION #include<iostream> using namespace std; class class _name { public: Void function_name() { statement1; Statement 2; ---- }
  • 9. MEMBER FUNCTION OUTSIDE CLASS DECLARATION #include<iostream> using namespace std; class class_name { public; Void function_name(); }; void class_name :: function_name() { statement1; Statement 2; 
.. }
  • 10. The operator :: is known as scope resolution operator. This is used to access member functions to their corresponding class in following form. Type class_name::function_name(parameter list) { function body } where : type : is the data type of value to be returned. class_name : is the name of the class to which the function belongs. function_name : is the name of the function being declared. parameter list : list of formal arguments.
  • 11.  It is an activity of defining a new class in terms of an existing class. The existing class is known as a base class.( i.e. super class) and the new class is known as derived class ( ie. Sub class ) .  In c++, a derived class can be obtained by adding some new data structures and functions to base class. The derived class inherits the members of its base class without the need to redefine them. The format for defining a derived class is given below: Class <derived class> : Visibility mode < base class> { .. .. };  Where class: is a reserved word <derived class > : is the name of the subclass or new class being derived. Visibility mode : is the mode of access to items from the base class. The access mode is optional and can be either of the following type: Private , public & protected
  • 12. Accessible from / Access mode Base Class Derived class Outside Public Yes Yes Yes Protected Yes Yes No Private Yes No No  The action of visibility mode or access specifiers as follows:
  • 13. The inheritances are classified in following categories: Single inheritance Hierarchical inheritance Multilevel inheritance Multiple inheritance BASE CLASS SUB CLASS SINGLE INHERITANCE : In this the single derived class is present.
  • 14. HIERARCHICAL INHERITANCE : In hierarchical inheritance, using one super or base class & multiple derived /sub classes. SUPER CLASS OR BASE CLASS SUB CLASS SUB CLASS
  • 15. MULTILEVEL INHERITANCE BASE CLASS SUB CLASS/ BASE CLASS SUB CLASS  We know that a derived class with a single base class is said to form single inheritance. The derived class can also become a base class for some other derived class.  This type of chain of deriving classes can go on as for as necessary.The inheritance of this tupe is known as multilevel inheritance.
  • 16. MULTIPLE INHERITANCE  A class can inherit properties from more than one base class. this type of inheritance is called as multiple inheritance. Please notice that this inheritance is different from hierarchical inheritance wherein subclasses share the same base class. It is also different from multilevel inheritance wherein a subclass is derived from a class which itself is derived from another class and so on . X Y Z Object Base class Base class Derived class or Sub Class
  • 17. Constructors:  A class constructor is a special member function of a class that is executed whenever we create new objects of that class. A constructor will have exact same name as the class and it does not have any return type at all, not even void. Constructors can be very useful for setting initial values for certain member variables.  The constructor function can also be used by a programmer to initialize the internal data members of the object. In C++ , there are three types of constructors: 1. The default constructor 2. Parameterized constructors 3. The copy constructor Destructors :  A destructor is a special member function of a class that is executed whenever an object of it's class goes out of scope or whenever the delete expression is applied to a pointer to the object of that class.  A destructor will have exact same name as the class prefixed with a tilde (~) and it can neither return a value nor can it take any parameters. Destructor can be very useful for releasing resources before coming out of the program like closing files, releasing memories etc.