SlideShare uma empresa Scribd logo
1 de 15
Language
Elizabeth Pisarek, Cassie Baldus, & Dylan Eckstein
Basic knowledge of C++
● Developed by Bjarne Stroustrup
● It is an extension of the C language.
● Possible to code C++ in a "C style" or "object-
oriented style."
○ It can be coded in either way and is thus an
effective example of a hybrid language
● It is considered an intermediate-level language
★ C++ is a collection of predefined classes, which are
data types that can be instantiated multiple times
“Hello World” in C++
using namespace std;
#include <iostream>
// My first C++ program!
int main(void)
{
cout << "hello world!" <<
endl;
return 0;
}
Use the standard namespace
Include standard
iostream classes
A C++ comment
cout is an
instance of
ostream
operator overloading
(two different argument types!)
New Keywords
In addition the keywords inherited from C, C++ adds:
Exceptions catch, throw, try
Declarations:
bool, class, enum, explicit, export,
friend, inline, mutable, namespace,
operator, private, protected, public,
template, typename, using, virtual,
volatile, wchar_t
Expressions:
and, and_eq, bitand, bitor, compl,
const_cast, delete, dynamic_cast,
false, new, not, not_eq, or, or_eq,
reinterpret_cast, static_cast, this,
true, typeid, xor, xor_eq
Pointers in C++
int i;
int *iPtr; // a pointer to an integer
iPtr = &i; // iPtr contains the address of I
*iPtr = 100;
…
100
456FD4
456FD4
456FD0
i
iPtr
…
variable value Address in
hex
C++ Blocks
● Allow a section of code to have its own local vars
whose scope is minimized.
● Such vars are stack dynamic, so they have their
storage allocated when the section is entered and
deallocated when the section is exited
C++:
for (...)
{
int index;
...
}
6
C++ Binding
● Binding refers to the process that is to be used for
converting functions and variables into machine
language addresses.
● C++ supports two types:
1. Static/Early Binding
2. Dynamic/Late Binding
7
Static/Early Binding
● In static binding, there are similar function names that
are used in many places, their references and their
positions are indicated explicitly by the compiler.
● Their ambiguities are fixed at compile time.
8
Static/Early Binding Example
class first // base class
{
int d;
public:
void display() {------} // base class member function
};
class second : public first // derived class
{
int k;
public:
void display() {------} // member function of derived class
}
9
Dynamic/Late Binding
● In the case of a few programs, it is impossible to know
which function is to be called until run time. This is
called dynamic binding.
● Dynamic binding of member functions in C++ can be
done using the virtual keyword. The member function
followed by the keyword is called a virtual function.
10
Dynamic/Late Binding Example
class first // base class
{
int d;
public:
virtual void display() {------} // base class member function
};
class second : public first // derived class
{
int k;
public:
virtual void display() {------} // member function of derived
class
}
11
C++ Static Scoping
● C++ variables are always statically scoped
● Binding of a variable can be determined by program
text and is independent of the run-time function call
stack.
● C++ doesn't use Dynamic scoping.
12
C++ Type checking
● Type Checking: Determining if data types make sense
for the program and follow constraints
● Static Type Checking: Type checking is done when
the program is compiled
● Dynamic Type Checking: Type checking is done at
runtime
● C++ uses static type checking
13
C++ Run time environment
● There isn't a universal C++ runtime
system, but in the typical OS the
primary action of the C++ runtime is
to dynamically link shared libraries to
an executable.
14
15

Mais conteúdo relacionado

Mais procurados

difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#Sireesh K
 
Object Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World ScenarioObject Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World ScenarioDurgesh Singh
 
Virtual function
Virtual functionVirtual function
Virtual functionharman kaur
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsClarkTony
 
C and C++ Industrial Training Jalandhar
C and C++ Industrial Training JalandharC and C++ Industrial Training Jalandhar
C and C++ Industrial Training JalandharDreamtech Labs
 
introduction to c programming language
introduction to c programming languageintroduction to c programming language
introduction to c programming languagesanjay joshi
 
C++ to java
C++ to javaC++ to java
C++ to javaAjmal Ak
 
Theory of programming
Theory of programmingTheory of programming
Theory of programmingtcc_joemarie
 
Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"Fwdays
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xiiSyed Zaid Irshad
 
Why C is Called Structured Programming Language
Why C is Called Structured Programming LanguageWhy C is Called Structured Programming Language
Why C is Called Structured Programming LanguageSinbad Konick
 
Mobile C++
Mobile C++Mobile C++
Mobile C++gdgut
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++Saket Pathak
 
Hands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageHands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageVincenzo De Florio
 
Scaling Language Specifications
Scaling Language SpecificationsScaling Language Specifications
Scaling Language Specificationsericupnorth
 

Mais procurados (20)

difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
Object Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World ScenarioObject Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World Scenario
 
2. data, operators, io
2. data, operators, io2. data, operators, io
2. data, operators, io
 
Virtual function
Virtual functionVirtual function
Virtual function
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddings
 
C and C++ Industrial Training Jalandhar
C and C++ Industrial Training JalandharC and C++ Industrial Training Jalandhar
C and C++ Industrial Training Jalandhar
 
introduction to c programming language
introduction to c programming languageintroduction to c programming language
introduction to c programming language
 
C language
C languageC language
C language
 
C++ to java
C++ to javaC++ to java
C++ to java
 
Theory of programming
Theory of programmingTheory of programming
Theory of programming
 
basics of c++
basics of c++basics of c++
basics of c++
 
Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xii
 
Why C is Called Structured Programming Language
Why C is Called Structured Programming LanguageWhy C is Called Structured Programming Language
Why C is Called Structured Programming Language
 
Mobile C++
Mobile C++Mobile C++
Mobile C++
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++
 
Next .NET and C#
Next .NET and C#Next .NET and C#
Next .NET and C#
 
Hands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageHands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming Language
 
Scaling Language Specifications
Scaling Language SpecificationsScaling Language Specifications
Scaling Language Specifications
 
C Lecture
C LectureC Lecture
C Lecture
 

Semelhante a C++ language

Semelhante a C++ language (20)

C++primer
C++primerC++primer
C++primer
 
C++ Training
C++ TrainingC++ Training
C++ Training
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
 
CSharp presentation and software developement
CSharp presentation and software developementCSharp presentation and software developement
CSharp presentation and software developement
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
Synapseindia dot net development
Synapseindia dot net developmentSynapseindia dot net development
Synapseindia dot net development
 
Course1
Course1Course1
Course1
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
88 c programs 15184
88 c programs 1518488 c programs 15184
88 c programs 15184
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
Functions And Header Files In C++ | Bjarne stroustrup
Functions And Header Files In C++ | Bjarne stroustrupFunctions And Header Files In C++ | Bjarne stroustrup
Functions And Header Files In C++ | Bjarne stroustrup
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
C++ language
C++ languageC++ language
C++ language
 
C language updated
C language updatedC language updated
C language updated
 
Csharp_mahesh
Csharp_maheshCsharp_mahesh
Csharp_mahesh
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 

Mais de Elizabeth Pisarek

Mais de Elizabeth Pisarek (16)

A Day In The Life Of The Homeless In KC
A Day In The Life Of The Homeless In KCA Day In The Life Of The Homeless In KC
A Day In The Life Of The Homeless In KC
 
Working with JavaScript
Working with JavaScriptWorking with JavaScript
Working with JavaScript
 
jQuery Code Testing
jQuery Code TestingjQuery Code Testing
jQuery Code Testing
 
Harley Davidson Flyer for AdInk
Harley Davidson Flyer for AdInkHarley Davidson Flyer for AdInk
Harley Davidson Flyer for AdInk
 
Homepage for Website in 5 minutes
Homepage for Website in 5 minutesHomepage for Website in 5 minutes
Homepage for Website in 5 minutes
 
John Wick Movie Trailer & Poster Design
John Wick Movie Trailer & Poster DesignJohn Wick Movie Trailer & Poster Design
John Wick Movie Trailer & Poster Design
 
ACM - Women flyer
ACM - Women flyerACM - Women flyer
ACM - Women flyer
 
Personal website Project
Personal website ProjectPersonal website Project
Personal website Project
 
Flyer Example
Flyer ExampleFlyer Example
Flyer Example
 
Social media content
Social media contentSocial media content
Social media content
 
Liking facebook page
Liking facebook pageLiking facebook page
Liking facebook page
 
JDTI Spec Sheet Design
JDTI Spec Sheet DesignJDTI Spec Sheet Design
JDTI Spec Sheet Design
 
User Experience Assignment
User Experience AssignmentUser Experience Assignment
User Experience Assignment
 
Art Tech Website Design Layout
Art Tech Website Design LayoutArt Tech Website Design Layout
Art Tech Website Design Layout
 
Robot Research Paper
Robot Research PaperRobot Research Paper
Robot Research Paper
 
Popularity & Traffic Paper
Popularity & Traffic PaperPopularity & Traffic Paper
Popularity & Traffic Paper
 

Último

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

C++ language

  • 1. Language Elizabeth Pisarek, Cassie Baldus, & Dylan Eckstein
  • 2. Basic knowledge of C++ ● Developed by Bjarne Stroustrup ● It is an extension of the C language. ● Possible to code C++ in a "C style" or "object- oriented style." ○ It can be coded in either way and is thus an effective example of a hybrid language ● It is considered an intermediate-level language ★ C++ is a collection of predefined classes, which are data types that can be instantiated multiple times
  • 3. “Hello World” in C++ using namespace std; #include <iostream> // My first C++ program! int main(void) { cout << "hello world!" << endl; return 0; } Use the standard namespace Include standard iostream classes A C++ comment cout is an instance of ostream operator overloading (two different argument types!)
  • 4. New Keywords In addition the keywords inherited from C, C++ adds: Exceptions catch, throw, try Declarations: bool, class, enum, explicit, export, friend, inline, mutable, namespace, operator, private, protected, public, template, typename, using, virtual, volatile, wchar_t Expressions: and, and_eq, bitand, bitor, compl, const_cast, delete, dynamic_cast, false, new, not, not_eq, or, or_eq, reinterpret_cast, static_cast, this, true, typeid, xor, xor_eq
  • 5. Pointers in C++ int i; int *iPtr; // a pointer to an integer iPtr = &i; // iPtr contains the address of I *iPtr = 100; … 100 456FD4 456FD4 456FD0 i iPtr … variable value Address in hex
  • 6. C++ Blocks ● Allow a section of code to have its own local vars whose scope is minimized. ● Such vars are stack dynamic, so they have their storage allocated when the section is entered and deallocated when the section is exited C++: for (...) { int index; ... } 6
  • 7. C++ Binding ● Binding refers to the process that is to be used for converting functions and variables into machine language addresses. ● C++ supports two types: 1. Static/Early Binding 2. Dynamic/Late Binding 7
  • 8. Static/Early Binding ● In static binding, there are similar function names that are used in many places, their references and their positions are indicated explicitly by the compiler. ● Their ambiguities are fixed at compile time. 8
  • 9. Static/Early Binding Example class first // base class { int d; public: void display() {------} // base class member function }; class second : public first // derived class { int k; public: void display() {------} // member function of derived class } 9
  • 10. Dynamic/Late Binding ● In the case of a few programs, it is impossible to know which function is to be called until run time. This is called dynamic binding. ● Dynamic binding of member functions in C++ can be done using the virtual keyword. The member function followed by the keyword is called a virtual function. 10
  • 11. Dynamic/Late Binding Example class first // base class { int d; public: virtual void display() {------} // base class member function }; class second : public first // derived class { int k; public: virtual void display() {------} // member function of derived class } 11
  • 12. C++ Static Scoping ● C++ variables are always statically scoped ● Binding of a variable can be determined by program text and is independent of the run-time function call stack. ● C++ doesn't use Dynamic scoping. 12
  • 13. C++ Type checking ● Type Checking: Determining if data types make sense for the program and follow constraints ● Static Type Checking: Type checking is done when the program is compiled ● Dynamic Type Checking: Type checking is done at runtime ● C++ uses static type checking 13
  • 14. C++ Run time environment ● There isn't a universal C++ runtime system, but in the typical OS the primary action of the C++ runtime is to dynamically link shared libraries to an executable. 14
  • 15. 15