SlideShare a Scribd company logo
1 of 3
Download to read offline
C++ V2
C++ Classes and Objects
the central feature of C++ that supports object-oriented programming and are often called user-defined types.
C++ Class Definitions
When you define a class, you define a blueprint for a data type.
The keyword public determines the access attributes of the members of the class that follows it.
A public member can be accessed from outside the class anywhere within the scope of the class object.
You can also specify the members of a class as private or protected.
C++ Inheritance
Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an appli
cation.
This also provides an opportunity to reuse the code functionality and fast implementation time.
This existing class is called the base class, and the inherited class is referred to as the derived class.
The idea of inheritance implements the is-a relationship.
Access Control and Inheritance
Access public protected private
Same class yes yes yes
Derived classes yes yes no
Outside classes yes no no
Type of Inheritance
Multiple Inheritance
A C++ class can inherit members from more than one base class and here is the extended syntax โˆ’
class derived-class: access baseA, access baseB....
C++ Overloading (Operator and Function)
C++ allows you to specify more than one definition for a function or an operator in the same scope, which is called
function overloading and operator overloading respectively.
Function Overloading in C++
you can have multiple definitions for the same function name in the same scope.
Operators Overloading in C++
You can redefine or overload most of the built-in operators available in C++.
Polymorphism in C++
The word polymorphism means having many forms.
C++ polymorphism means that a call to a member function will cause a different function to be executed depending
on the type of object that invokes the function.
Compile time polymorphism or early binding : eg. Overloading
Run time polymorphism or late binding : eg. Overriding / Virtual Funtions
Pure Virtual Functions : It is possible that we want to include a virtual function in a base class so that it can be redef
ined in a derived class
Data Abstraction in C++
Data abstraction refers to providing only essential information to the outside world and hiding their background deta
ils,
i.e., to represent the needed information in program without presenting the details.
we can implement data abstraction by defining the member variable as private.
Data Encapsulation in C++
Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulat
e the data.
Data encapsulation led to the important OOP concept of data hiding
Interfaces in C++ (Abstract Classes)
The C++ interfaces are implemented using abstract classes.
A class is made abstract by declaring at least one of its functions as pure virtual function.
C++ Files and Streams
we have been using the iostream standard library, which provides cin and cout methods for reading from standard i
nput and writing to standard output respectively.
To perform file processing in C++, header files <iostream> and <fstream> must be included in your C++ source file
.
fstream
This data type represents the file stream generally, and has the capabilities of both ofstream and ifstream which mea
ns it can create files, write information to files, and read information from files.
ofstream
This data type represents the output file stream and is used to create files and to write information to files.
ifstream
This data type represents the input file stream and is used to read information from files.
Modes:
ios::app
Append mode. All output to that file to be appended to the end
ios::in
Open a file for reading.
ios::out
Open a file for writing.
ios::trunc
If the file already exists, its contents will be truncated before opening the file.
File Position Pointers
The member functions are seekg ("seek get") for istream and seekp ("seek put") for ostream.
The first argument to seekg and seekp normally is a long integer.
A second argument can be specified to indicate the seek direction. (The seek direction can be ios::beg (the default) ,
ios::cur , ios::end).
C++ Exception Handling
An exception is a problem that arises during the execution of a program.
Exceptions provide a way to transfer control from one part of a program to another.
C++ exception handling is built upon three keywords: try, catch, and throw.
eg.
try {
// protected code
} catch( ExceptionName e ) {
// code to handle ExceptionName exception
}
C++ Dynamic Memory
Memory in your C++ program is divided into two parts โˆ’
The stack โˆ’ All variables declared inside the function will take up memory from the stack.
The heap โˆ’ This is unused memory of the program and can be used to allocate the memory dynamically when prog
ram runs.
new operator to allocate memory dynamically for any data-type.
you can use delete operator, which de-allocates memory that was previously allocated by new operator.
eg.
double* pvalue = NULL; // Pointer initialized with null
pvalue = new double; // Request memory for the variable
delete pvalue; // Release memory pointed to by pvalue
Dynamic Memory Allocation for Objects
Objects are no different from simple data types.
eg. : Box* myBoxArray = new Box[4];
delete [] myBoxArray; // Delete array

More Related Content

What's hot

2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++Kuntal Bhowmick
ย 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++ Hridoy Bepari
ย 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data typesManisha Keim
ย 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
ย 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Examshishamrizvi
ย 
Basic Structure Of C++
Basic Structure Of C++Basic Structure Of C++
Basic Structure Of C++DevangiParekh1
ย 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++Neeru Mittal
ย 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++Rokonuzzaman Rony
ย 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures topu93
ย 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteachingeteaching
ย 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++Pranali Chaudhari
ย 

What's hot (20)

2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
ย 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
ย 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
ย 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
ย 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
ย 
C intro
C introC intro
C intro
ย 
Unit iii
Unit iiiUnit iii
Unit iii
ย 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
ย 
Basic Structure Of C++
Basic Structure Of C++Basic Structure Of C++
Basic Structure Of C++
ย 
C++ Basics
C++ BasicsC++ Basics
C++ Basics
ย 
C# String
C# StringC# String
C# String
ย 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
ย 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
ย 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++
ย 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
ย 
Data Handling
Data HandlingData Handling
Data Handling
ย 
Data types in c++
Data types in c++Data types in c++
Data types in c++
ย 
Chapter 2
Chapter 2Chapter 2
Chapter 2
ย 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
ย 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
ย 

Similar to C++ Version 2

Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++Amresh Raj
ย 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.docabdulhaq467432
ย 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPTAjay Chimmani
ย 
My c++
My c++My c++
My c++snathick
ย 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plusSayed Ahmed
ย 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Sayed Ahmed
ย 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++SadiqullahGhani1
ย 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPPaptechsravan
ย 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ ProgrammingPreeti Kashyap
ย 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1ReKruiTIn.com
ย 
C++ Object Oriented Programming
C++  Object Oriented ProgrammingC++  Object Oriented Programming
C++ Object Oriented ProgrammingGamindu Udayanga
ย 
Inheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptxInheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptxABHINAVARYANCSEA301
ย 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnetGaurav Singh
ย 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itPushkarNiroula1
ย 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&aKumaran K
ย 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)Jay Patel
ย 

Similar to C++ Version 2 (20)

Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
ย 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
ย 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
ย 
My c++
My c++My c++
My c++
ย 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plus
ย 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)
ย 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
ย 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
ย 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
ย 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
ย 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
ย 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
ย 
C++ Object Oriented Programming
C++  Object Oriented ProgrammingC++  Object Oriented Programming
C++ Object Oriented Programming
ย 
Inheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptxInheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptx
ย 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
ย 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
ย 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to it
ย 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
ย 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&a
ย 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
ย 

More from JIGAR MAKHIJA

Php gd library
Php gd libraryPhp gd library
Php gd libraryJIGAR MAKHIJA
ย 
Php pattern matching
Php pattern matchingPhp pattern matching
Php pattern matchingJIGAR MAKHIJA
ย 
Php cookies
Php cookiesPhp cookies
Php cookiesJIGAR MAKHIJA
ย 
Php functions
Php functionsPhp functions
Php functionsJIGAR MAKHIJA
ย 
Php sessions
Php sessionsPhp sessions
Php sessionsJIGAR MAKHIJA
ย 
Php server variables
Php server variablesPhp server variables
Php server variablesJIGAR MAKHIJA
ย 
Db function
Db functionDb function
Db functionJIGAR MAKHIJA
ย 
SAP Ui5 content
SAP Ui5 contentSAP Ui5 content
SAP Ui5 contentJIGAR MAKHIJA
ย 
Solution doc
Solution docSolution doc
Solution docJIGAR MAKHIJA
ย 
Overview on Application protocols in Internet of Things
Overview on Application protocols in Internet of ThingsOverview on Application protocols in Internet of Things
Overview on Application protocols in Internet of ThingsJIGAR MAKHIJA
ย 
125 green iot
125 green iot125 green iot
125 green iotJIGAR MAKHIJA
ย 
Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)JIGAR MAKHIJA
ย 
Embedded system lab work
Embedded system lab workEmbedded system lab work
Embedded system lab workJIGAR MAKHIJA
ย 
Presentation on iot- Internet of Things
Presentation on iot- Internet of ThingsPresentation on iot- Internet of Things
Presentation on iot- Internet of ThingsJIGAR MAKHIJA
ย 
Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120JIGAR MAKHIJA
ย 
View Alignment Techniques
View Alignment TechniquesView Alignment Techniques
View Alignment TechniquesJIGAR MAKHIJA
ย 
Letters (complaints & invitations)
Letters (complaints & invitations)Letters (complaints & invitations)
Letters (complaints & invitations)JIGAR MAKHIJA
ย 
Letter Writing invitation-letter
Letter Writing invitation-letterLetter Writing invitation-letter
Letter Writing invitation-letterJIGAR MAKHIJA
ย 
Communication skills Revised PPT
Communication skills Revised PPTCommunication skills Revised PPT
Communication skills Revised PPTJIGAR MAKHIJA
ย 

More from JIGAR MAKHIJA (20)

Php gd library
Php gd libraryPhp gd library
Php gd library
ย 
Php pattern matching
Php pattern matchingPhp pattern matching
Php pattern matching
ย 
Php cookies
Php cookiesPhp cookies
Php cookies
ย 
Php functions
Php functionsPhp functions
Php functions
ย 
Php sessions
Php sessionsPhp sessions
Php sessions
ย 
Php server variables
Php server variablesPhp server variables
Php server variables
ย 
Db function
Db functionDb function
Db function
ย 
SAP Ui5 content
SAP Ui5 contentSAP Ui5 content
SAP Ui5 content
ย 
Solution doc
Solution docSolution doc
Solution doc
ย 
Overview on Application protocols in Internet of Things
Overview on Application protocols in Internet of ThingsOverview on Application protocols in Internet of Things
Overview on Application protocols in Internet of Things
ย 
125 green iot
125 green iot125 green iot
125 green iot
ย 
Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)
ย 
Embedded system lab work
Embedded system lab workEmbedded system lab work
Embedded system lab work
ย 
Presentation on iot- Internet of Things
Presentation on iot- Internet of ThingsPresentation on iot- Internet of Things
Presentation on iot- Internet of Things
ย 
Oracle
OracleOracle
Oracle
ย 
Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120
ย 
View Alignment Techniques
View Alignment TechniquesView Alignment Techniques
View Alignment Techniques
ย 
Letters (complaints & invitations)
Letters (complaints & invitations)Letters (complaints & invitations)
Letters (complaints & invitations)
ย 
Letter Writing invitation-letter
Letter Writing invitation-letterLetter Writing invitation-letter
Letter Writing invitation-letter
ย 
Communication skills Revised PPT
Communication skills Revised PPTCommunication skills Revised PPT
Communication skills Revised PPT
ย 

Recently uploaded

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
ย 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
ย 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
ย 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
ย 
USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
ย 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
ย 
call girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
ย 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
ย 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
ย 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
ย 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
ย 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
ย 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
ย 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
ย 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
ย 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
ย 

Recently uploaded (20)

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
ย 
Model Call Girl in Tilak Nagar Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”
Model Call Girl in Tilak Nagar Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”Model Call Girl in Tilak Nagar Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”
Model Call Girl in Tilak Nagar Delhi reach out to us at ๐Ÿ”9953056974๐Ÿ”
ย 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
ย 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
ย 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
ย 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
ย 
USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSยฎ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
ย 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
ย 
call girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Kamla Market (DELHI) ๐Ÿ” >เผ’9953330565๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
ย 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
ย 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
ย 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ย 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
ย 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
ย 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
ย 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
ย 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
ย 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
ย 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ย 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
ย 

C++ Version 2

  • 1. C++ V2 C++ Classes and Objects the central feature of C++ that supports object-oriented programming and are often called user-defined types. C++ Class Definitions When you define a class, you define a blueprint for a data type. The keyword public determines the access attributes of the members of the class that follows it. A public member can be accessed from outside the class anywhere within the scope of the class object. You can also specify the members of a class as private or protected. C++ Inheritance Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an appli cation. This also provides an opportunity to reuse the code functionality and fast implementation time. This existing class is called the base class, and the inherited class is referred to as the derived class. The idea of inheritance implements the is-a relationship. Access Control and Inheritance Access public protected private Same class yes yes yes Derived classes yes yes no Outside classes yes no no Type of Inheritance Multiple Inheritance A C++ class can inherit members from more than one base class and here is the extended syntax โˆ’ class derived-class: access baseA, access baseB.... C++ Overloading (Operator and Function) C++ allows you to specify more than one definition for a function or an operator in the same scope, which is called function overloading and operator overloading respectively. Function Overloading in C++ you can have multiple definitions for the same function name in the same scope. Operators Overloading in C++ You can redefine or overload most of the built-in operators available in C++. Polymorphism in C++ The word polymorphism means having many forms. C++ polymorphism means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function. Compile time polymorphism or early binding : eg. Overloading Run time polymorphism or late binding : eg. Overriding / Virtual Funtions Pure Virtual Functions : It is possible that we want to include a virtual function in a base class so that it can be redef ined in a derived class
  • 2. Data Abstraction in C++ Data abstraction refers to providing only essential information to the outside world and hiding their background deta ils, i.e., to represent the needed information in program without presenting the details. we can implement data abstraction by defining the member variable as private. Data Encapsulation in C++ Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulat e the data. Data encapsulation led to the important OOP concept of data hiding Interfaces in C++ (Abstract Classes) The C++ interfaces are implemented using abstract classes. A class is made abstract by declaring at least one of its functions as pure virtual function. C++ Files and Streams we have been using the iostream standard library, which provides cin and cout methods for reading from standard i nput and writing to standard output respectively. To perform file processing in C++, header files <iostream> and <fstream> must be included in your C++ source file . fstream This data type represents the file stream generally, and has the capabilities of both ofstream and ifstream which mea ns it can create files, write information to files, and read information from files. ofstream This data type represents the output file stream and is used to create files and to write information to files. ifstream This data type represents the input file stream and is used to read information from files. Modes: ios::app Append mode. All output to that file to be appended to the end ios::in Open a file for reading. ios::out Open a file for writing. ios::trunc If the file already exists, its contents will be truncated before opening the file. File Position Pointers The member functions are seekg ("seek get") for istream and seekp ("seek put") for ostream. The first argument to seekg and seekp normally is a long integer. A second argument can be specified to indicate the seek direction. (The seek direction can be ios::beg (the default) , ios::cur , ios::end). C++ Exception Handling An exception is a problem that arises during the execution of a program. Exceptions provide a way to transfer control from one part of a program to another. C++ exception handling is built upon three keywords: try, catch, and throw. eg. try {
  • 3. // protected code } catch( ExceptionName e ) { // code to handle ExceptionName exception } C++ Dynamic Memory Memory in your C++ program is divided into two parts โˆ’ The stack โˆ’ All variables declared inside the function will take up memory from the stack. The heap โˆ’ This is unused memory of the program and can be used to allocate the memory dynamically when prog ram runs. new operator to allocate memory dynamically for any data-type. you can use delete operator, which de-allocates memory that was previously allocated by new operator. eg. double* pvalue = NULL; // Pointer initialized with null pvalue = new double; // Request memory for the variable delete pvalue; // Release memory pointed to by pvalue Dynamic Memory Allocation for Objects Objects are no different from simple data types. eg. : Box* myBoxArray = new Box[4]; delete [] myBoxArray; // Delete array