SlideShare a Scribd company logo
1 of 18
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

What's hot

friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)Ritika Sharma
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++HalaiHansaika
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language Mohamed Loey
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++Ankur Pandey
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control StructureSokngim Sa
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Languagesatvirsandhu9
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract classAmit Trivedi
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
C++ language basic
C++ language basicC++ language basic
C++ language basicWaqar Younis
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Kamlesh Makvana
 
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...cprogrammings
 

What's hot (20)

friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
C++ programming
C++ programmingC++ programming
C++ programming
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Constructors in C++
Constructors in C++Constructors in C++
Constructors in C++
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
C# basics
 C# basics C# basics
C# basics
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function
 
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
 
C language ppt
C language pptC language ppt
C language ppt
 

Similar to C++ presentation

Similar to C++ presentation (20)

Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Ppt of c++ vs c#
Ppt of c++ vs c#Ppt of c++ vs c#
Ppt of c++ vs c#
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
11 Inheritance.ppt
11 Inheritance.ppt11 Inheritance.ppt
11 Inheritance.ppt
 
Class objects oopm
Class objects oopmClass objects oopm
Class objects oopm
 
Class and object in C++ By Pawan Thakur
Class and object in C++ By Pawan ThakurClass and object in C++ By Pawan Thakur
Class and object in C++ By Pawan Thakur
 
Inheritance
InheritanceInheritance
Inheritance
 
C++ Notes
C++ NotesC++ Notes
C++ Notes
 
OOPs & C++ UNIT 3
OOPs & C++ UNIT 3OOPs & C++ UNIT 3
OOPs & C++ UNIT 3
 
Introduction to object oriented programming concepts
Introduction to object oriented programming conceptsIntroduction to object oriented programming concepts
Introduction to object oriented programming concepts
 
6 Inheritance
6 Inheritance6 Inheritance
6 Inheritance
 
OOP
OOPOOP
OOP
 
Lecturespecial
LecturespecialLecturespecial
Lecturespecial
 
Access controlaspecifier and visibilty modes
Access controlaspecifier and visibilty modesAccess controlaspecifier and visibilty modes
Access controlaspecifier and visibilty modes
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance
Inheritance Inheritance
Inheritance
 
Ganesh groups
Ganesh groupsGanesh groups
Ganesh groups
 
inheritance
inheritanceinheritance
inheritance
 
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
 
Inheritance
InheritanceInheritance
Inheritance
 

Recently uploaded

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

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.