SlideShare a Scribd company logo
1 of 4
Download to read offline
Material 18
18/43 Why is C++ lookup simpler?
• Smalltalk has no static type system
– Code p message:pars could refer to any object
– Need to find method using pointer from object
– Different classes will put methods at different place in method
dictionary
• C++ type gives compiler some superclass
– Offset of data, fctn ptr same in subclass and superclass
– Offset of data and function ptr known at compile time
– Code p->move(x) compiles to equivalent of
(*(p->vptr[1]))(p,x) if move is first function in vtable
data passed to member function; see next slides
19/43
Point p = new Pt(3);
p->move(2); // (*(p->vptr[0]))(p,2)
Looking up methods
3
5
blue
Point object
ColorPoint object
x
vptr
x
vptr
c
Point vtable
ColorPoint vtable
Code for move
Code for move
Code for darken
20/43 Looking up methods
3
5
blue
darken()
Point object
ColorPoint object
x
vptr
x
vptr
c
Point vtable
ColorPoint vtable
Code for move
Code for move
Code for darken
Point cp = new ColorPt(5,blue);
cp->move(2); // (*(cp->vptr[0]))(cp,2)

More Related Content

What's hot

0015.register allocation-graph-coloring
0015.register allocation-graph-coloring0015.register allocation-graph-coloring
0015.register allocation-graph-coloringsean chen
 
Unsupervised Learning: Clustering
Unsupervised Learning: Clustering Unsupervised Learning: Clustering
Unsupervised Learning: Clustering Experfy
 
Bitmap Indexes for Relational XML Twig Query Processing
Bitmap Indexes for Relational XML Twig Query ProcessingBitmap Indexes for Relational XML Twig Query Processing
Bitmap Indexes for Relational XML Twig Query ProcessingKyong-Ha Lee
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlibPiyush rai
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksMohammad Vaseem Akaram
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms ManishPrajapati78
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...Mumbai B.Sc.IT Study
 
NumPy sorting (and dancing and memes): ​ a short review for students​
NumPy sorting (and dancing and memes): ​ a short review for students​ NumPy sorting (and dancing and memes): ​ a short review for students​
NumPy sorting (and dancing and memes): ​ a short review for students​ VladimirFadeev4
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programmingsoni_nits
 
single source shorest path
single source shorest pathsingle source shorest path
single source shorest pathsowfi
 
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...Monica Sabharwal
 
R tools for HiC data visualization
R tools for HiC data visualizationR tools for HiC data visualization
R tools for HiC data visualizationtuxette
 

What's hot (20)

0015.register allocation-graph-coloring
0015.register allocation-graph-coloring0015.register allocation-graph-coloring
0015.register allocation-graph-coloring
 
Unsupervised Learning: Clustering
Unsupervised Learning: Clustering Unsupervised Learning: Clustering
Unsupervised Learning: Clustering
 
Bitmap Indexes for Relational XML Twig Query Processing
Bitmap Indexes for Relational XML Twig Query ProcessingBitmap Indexes for Relational XML Twig Query Processing
Bitmap Indexes for Relational XML Twig Query Processing
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlib
 
Stacks
StacksStacks
Stacks
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
 
02 Stack
02 Stack02 Stack
02 Stack
 
Data Structures 01
Data Structures 01Data Structures 01
Data Structures 01
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
 
NumPy sorting (and dancing and memes): ​ a short review for students​
NumPy sorting (and dancing and memes): ​ a short review for students​ NumPy sorting (and dancing and memes): ​ a short review for students​
NumPy sorting (and dancing and memes): ​ a short review for students​
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programming
 
Permute
PermutePermute
Permute
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Hubba Deep Learning
Hubba Deep LearningHubba Deep Learning
Hubba Deep Learning
 
single source shorest path
single source shorest pathsingle source shorest path
single source shorest path
 
Ch8a
Ch8aCh8a
Ch8a
 
Deep Learning meetup
Deep Learning meetupDeep Learning meetup
Deep Learning meetup
 
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
 
R tools for HiC data visualization
R tools for HiC data visualizationR tools for HiC data visualization
R tools for HiC data visualization
 

Viewers also liked (19)

Lo16
Lo16Lo16
Lo16
 
Lo4
Lo4Lo4
Lo4
 
01
0101
01
 
Lo10
Lo10Lo10
Lo10
 
Lo20
Lo20Lo20
Lo20
 
Lo12
Lo12Lo12
Lo12
 
08
0808
08
 
Lo11
Lo11Lo11
Lo11
 
Lo7
Lo7Lo7
Lo7
 
02
0202
02
 
Lo13
Lo13Lo13
Lo13
 
Lo2
Lo2Lo2
Lo2
 
Lo15
Lo15Lo15
Lo15
 
Lo19
Lo19Lo19
Lo19
 
Lo5
Lo5Lo5
Lo5
 
Lo17
Lo17Lo17
Lo17
 
Lo9
Lo9Lo9
Lo9
 
Lo14
Lo14Lo14
Lo14
 
Lo8
Lo8Lo8
Lo8
 

Similar to Lo18

Similar to Lo18 (20)

0-Slot11-12-Pointers.pdf
0-Slot11-12-Pointers.pdf0-Slot11-12-Pointers.pdf
0-Slot11-12-Pointers.pdf
 
MTPLs
MTPLsMTPLs
MTPLs
 
l7-pointers.ppt
l7-pointers.pptl7-pointers.ppt
l7-pointers.ppt
 
Data visualization in Python
Data visualization in PythonData visualization in Python
Data visualization in Python
 
2008-03-04 - Geoprocessing with ArcGIS.pdf
2008-03-04 - Geoprocessing with ArcGIS.pdf2008-03-04 - Geoprocessing with ArcGIS.pdf
2008-03-04 - Geoprocessing with ArcGIS.pdf
 
SimpleArray between Python and C++
SimpleArray between Python and C++SimpleArray between Python and C++
SimpleArray between Python and C++
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
 
17 PYTHON MODULES-2.pdf
17 PYTHON MODULES-2.pdf17 PYTHON MODULES-2.pdf
17 PYTHON MODULES-2.pdf
 
Apclass (2)
Apclass (2)Apclass (2)
Apclass (2)
 
IRR Toolset, RPSL
IRR Toolset, RPSL IRR Toolset, RPSL
IRR Toolset, RPSL
 
Tribeflow on bitcoin data
Tribeflow on bitcoin dataTribeflow on bitcoin data
Tribeflow on bitcoin data
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented Technologies
 
Pointers.ppt
Pointers.pptPointers.ppt
Pointers.ppt
 
Pointers.ppt
Pointers.pptPointers.ppt
Pointers.ppt
 
L7 pointers
L7 pointersL7 pointers
L7 pointers
 
Notes fp201-pointer notes
Notes fp201-pointer notesNotes fp201-pointer notes
Notes fp201-pointer notes
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
C++11 & C++14
C++11 & C++14C++11 & C++14
C++11 & C++14
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)
 
Apclass
ApclassApclass
Apclass
 

More from liankei

More from liankei (16)

Lo 19
Lo 19Lo 19
Lo 19
 
Lo 18
Lo 18Lo 18
Lo 18
 
Lo 13
Lo 13Lo 13
Lo 13
 
Lo 12
Lo 12Lo 12
Lo 12
 
Lo 11
Lo 11Lo 11
Lo 11
 
Lo 06
Lo 06Lo 06
Lo 06
 
Lo 05
Lo 05Lo 05
Lo 05
 
Lo 04
Lo 04Lo 04
Lo 04
 
Lo 01
Lo 01Lo 01
Lo 01
 
Lo 16
Lo 16Lo 16
Lo 16
 
Lo 15
Lo 15Lo 15
Lo 15
 
Lo 09
Lo 09Lo 09
Lo 09
 
Lo 08
Lo 08Lo 08
Lo 08
 
Lo 03
Lo 03Lo 03
Lo 03
 
Lo 20
Lo 20Lo 20
Lo 20
 
Lo6
Lo6Lo6
Lo6
 

Recently uploaded

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Recently uploaded (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

Lo18

  • 2. 18/43 Why is C++ lookup simpler? • Smalltalk has no static type system – Code p message:pars could refer to any object – Need to find method using pointer from object – Different classes will put methods at different place in method dictionary • C++ type gives compiler some superclass – Offset of data, fctn ptr same in subclass and superclass – Offset of data and function ptr known at compile time – Code p->move(x) compiles to equivalent of (*(p->vptr[1]))(p,x) if move is first function in vtable data passed to member function; see next slides
  • 3. 19/43 Point p = new Pt(3); p->move(2); // (*(p->vptr[0]))(p,2) Looking up methods 3 5 blue Point object ColorPoint object x vptr x vptr c Point vtable ColorPoint vtable Code for move Code for move Code for darken
  • 4. 20/43 Looking up methods 3 5 blue darken() Point object ColorPoint object x vptr x vptr c Point vtable ColorPoint vtable Code for move Code for move Code for darken Point cp = new ColorPt(5,blue); cp->move(2); // (*(cp->vptr[0]))(cp,2)