Submit Search
Upload
Pointer and Object in C++
•
Download as PPT, PDF
•
4 likes
•
403 views
Kamlesh Makvana
Follow
Pointer to object in C++. Derived class Pointer, Basics of Virtual Functions in C++.
Read less
Read more
Technology
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 20
Download now
Recommended
Cpp tokens (2)
Cpp tokens (2)
Kamlesh Makvana
Operator overloading
Operator overloading
Kamlesh Makvana
Friend function
Friend function
Kamlesh Makvana
Operator Overloading
Operator Overloading
Juginder Pal Singh
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
corehard_by
ICT C++
ICT C++
Karthikeyan A K
Interoduction to c++
Interoduction to c++
Amresh Raj
Object Oriented Technologies
Object Oriented Technologies
Umesh Nikam
Recommended
Cpp tokens (2)
Cpp tokens (2)
Kamlesh Makvana
Operator overloading
Operator overloading
Kamlesh Makvana
Friend function
Friend function
Kamlesh Makvana
Operator Overloading
Operator Overloading
Juginder Pal Singh
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
corehard_by
ICT C++
ICT C++
Karthikeyan A K
Interoduction to c++
Interoduction to c++
Amresh Raj
Object Oriented Technologies
Object Oriented Technologies
Umesh Nikam
Polymorphism
Polymorphism
Nilesh Dalvi
C++ OOP Implementation
C++ OOP Implementation
Fridz Felisco
03. oop concepts
03. oop concepts
Haresh Jaiswal
Operator overloading
Operator overloading
Northeastern University
Object Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part I
Ajit Nayak
C++ Interview Questions
C++ Interview Questions
Kaushik Raghupathi
06. operator overloading
06. operator overloading
Haresh Jaiswal
Presentation 1st
Presentation 1st
Connex
C by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
Srichandan Sobhanayak
Top C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
Vineet Kumar Saini
Object oriented programming c++
Object oriented programming c++
Ankur Pandey
Oop2011 actor presentation_stal
Oop2011 actor presentation_stal
Michael Stal
SRAVANByCPP
SRAVANByCPP
aptechsravan
C++ questions and answers
C++ questions and answers
Deepak Singh
C++ interview question
C++ interview question
Durgesh Tripathi
Operator overloading
Operator overloading
piyush Kumar Sharma
Overloading
Overloading
poonamchopra7975
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
Michael Stal
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
ReKruiTIn.com
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
Tareq Hasan
C++ Training
C++ Training
SubhendraBasu5
Java basics
Java basics
Jitender Jain
More Related Content
What's hot
Polymorphism
Polymorphism
Nilesh Dalvi
C++ OOP Implementation
C++ OOP Implementation
Fridz Felisco
03. oop concepts
03. oop concepts
Haresh Jaiswal
Operator overloading
Operator overloading
Northeastern University
Object Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part I
Ajit Nayak
C++ Interview Questions
C++ Interview Questions
Kaushik Raghupathi
06. operator overloading
06. operator overloading
Haresh Jaiswal
Presentation 1st
Presentation 1st
Connex
C by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
Srichandan Sobhanayak
Top C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
Vineet Kumar Saini
Object oriented programming c++
Object oriented programming c++
Ankur Pandey
Oop2011 actor presentation_stal
Oop2011 actor presentation_stal
Michael Stal
SRAVANByCPP
SRAVANByCPP
aptechsravan
C++ questions and answers
C++ questions and answers
Deepak Singh
C++ interview question
C++ interview question
Durgesh Tripathi
Operator overloading
Operator overloading
piyush Kumar Sharma
Overloading
Overloading
poonamchopra7975
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
Michael Stal
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
ReKruiTIn.com
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
Tareq Hasan
What's hot
(20)
Polymorphism
Polymorphism
C++ OOP Implementation
C++ OOP Implementation
03. oop concepts
03. oop concepts
Operator overloading
Operator overloading
Object Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part I
C++ Interview Questions
C++ Interview Questions
06. operator overloading
06. operator overloading
Presentation 1st
Presentation 1st
C by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
Top C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
Object oriented programming c++
Object oriented programming c++
Oop2011 actor presentation_stal
Oop2011 actor presentation_stal
SRAVANByCPP
SRAVANByCPP
C++ questions and answers
C++ questions and answers
C++ interview question
C++ interview question
Operator overloading
Operator overloading
Overloading
Overloading
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
Similar to Pointer and Object in C++
C++ Training
C++ Training
SubhendraBasu5
Java basics
Java basics
Jitender Jain
Virtual function
Virtual function
sdrhr
OpenCon2014 - Sumatra as an Open Science tool
OpenCon2014 - Sumatra as an Open Science tool
Felix Z. Hoffmann
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
Accenture Hungary
Serverless survival kit
Serverless survival kit
Steve Houël
C++ Course module
C++ Course module
amandeep0224
Beware of Pointers
Beware of Pointers
ppd1961
High quality ap is with api platform
High quality ap is with api platform
Nelson Kopliku
Introduction to .NET Framework
Introduction to .NET Framework
Kamlesh Makvana
Build and Deploy Provider-hosted SharePoint Add-ins
Build and Deploy Provider-hosted SharePoint Add-ins
Danny Jessee
C Types - Extending Python
C Types - Extending Python
Priyank Kapadia
Teaching and Learning in Virtual Worlds
Teaching and Learning in Virtual Worlds
Rinda Montgomery
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]
Rome468
C++ Object Oriented Programming
C++ Object Oriented Programming
Gamindu Udayanga
Venice boats classification
Venice boats classification
Roberto Falconi
PythonOO.pdf oo Object Oriented programming
PythonOO.pdf oo Object Oriented programming
KhadijaKhadijaAouadi
Malware analysis
Malware analysis
Roberto Falconi
An approach for knowledge-driven product, process and resource mappings for a...
An approach for knowledge-driven product, process and resource mappings for a...
FAST-Lab. Factory Automation Systems and Technologies Laboratory, Tampere University of Technology
Bhushan Rathi
Bhushan Rathi
Bhushan Rathi
Similar to Pointer and Object in C++
(20)
C++ Training
C++ Training
Java basics
Java basics
Virtual function
Virtual function
OpenCon2014 - Sumatra as an Open Science tool
OpenCon2014 - Sumatra as an Open Science tool
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
Serverless survival kit
Serverless survival kit
C++ Course module
C++ Course module
Beware of Pointers
Beware of Pointers
High quality ap is with api platform
High quality ap is with api platform
Introduction to .NET Framework
Introduction to .NET Framework
Build and Deploy Provider-hosted SharePoint Add-ins
Build and Deploy Provider-hosted SharePoint Add-ins
C Types - Extending Python
C Types - Extending Python
Teaching and Learning in Virtual Worlds
Teaching and Learning in Virtual Worlds
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]
C++ Object Oriented Programming
C++ Object Oriented Programming
Venice boats classification
Venice boats classification
PythonOO.pdf oo Object Oriented programming
PythonOO.pdf oo Object Oriented programming
Malware analysis
Malware analysis
An approach for knowledge-driven product, process and resource mappings for a...
An approach for knowledge-driven product, process and resource mappings for a...
Bhushan Rathi
Bhushan Rathi
Recently uploaded
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
Recently uploaded
(20)
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Pointer and Object in C++
1.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 1 Department of Information Technology POINTER AND OBJECT IN C++
2.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 2 Department of Information Technology Pointer to object
3.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 3 Department of Information Technology How to store address of object into pointer and access members? Ans Pointer to object Two Ways to access member (*ptr).member Ptr->member
4.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 4 Department of Information Technology Pointer to object
5.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 5 Department of Information Technology How to store address of object created using new into pointer and access members? new Base(10) allocate memory at memory heap that is to be pointed by p1
6.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 6 Department of Information Technology How to create pointer to array of object?
7.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 7 Department of Information Technology How to call constructor of array of object through new?
8.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 8 Department of Information Technology What is this pointer? C++ use unique key word called this to represent object that invokes member function. i.e. Compiler store address of invoking object in this!!!! Example: obj1.max(obj2) Address of obj1 will get stored into this pointer. Use of this pointer To access data member of invoking object within class To return invoking object!!!
9.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 9 Department of Information Technology To access data member of invoking object within class 30
10.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 10 Department of Information Technology To return invoking object!! 30
11.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 11 Department of Information Technology Pointer to derived class
12.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 12 Department of Information Technology Pointer to derived class Note: Base class pointer could point to DerivedNote: Base class pointer could point to Derived Class object but derived class pointer can notClass object but derived class pointer can not Point to base class pointer!!!Point to base class pointer!!! Note: Base class pointer could point to DerivedNote: Base class pointer could point to Derived Class object but derived class pointer can notClass object but derived class pointer can not Point to base class pointer!!!Point to base class pointer!!!
13.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 13 Department of Information Technology Pointer to derived class Compiler generates error Because derived classCompiler generates error Because derived class public members can not be Accessed throughpublic members can not be Accessed through base class Pointer!!!base class Pointer!!! Reason: Base class pointer can only points toReason: Base class pointer can only points to Base class object within derived class.Base class object within derived class. Compiler generates error Because derived classCompiler generates error Because derived class public members can not be Accessed throughpublic members can not be Accessed through base class Pointer!!!base class Pointer!!! Reason: Base class pointer can only points toReason: Base class pointer can only points to Base class object within derived class.Base class object within derived class.
14.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 14 Department of Information Technology Pointer to derived class Compiler generates error Because derived classCompiler generates error Because derived class public members can not be Accessed throughpublic members can not be Accessed through base class Pointer!!!base class Pointer!!! Reason: Base class pointer can only points toReason: Base class pointer can only points to Base class object within derived class.Base class object within derived class. Compiler generates error Because derived classCompiler generates error Because derived class public members can not be Accessed throughpublic members can not be Accessed through base class Pointer!!!base class Pointer!!! Reason: Base class pointer can only points toReason: Base class pointer can only points to Base class object within derived class.Base class object within derived class.
15.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 15 Department of Information Technology Method Overriding Method Overgrind: If same signature of a functionMethod Overgrind: If same signature of a function in base class as well derived class.in base class as well derived class. Binding of Fun. Depend on type of Invoking objectBinding of Fun. Depend on type of Invoking object Base class-> base class member functionBase class-> base class member function Derived class-> Derived class member funDerived class-> Derived class member fun Compile time polymorphismCompile time polymorphism Method Overgrind: If same signature of a functionMethod Overgrind: If same signature of a function in base class as well derived class.in base class as well derived class. Binding of Fun. Depend on type of Invoking object.Binding of Fun. Depend on type of Invoking object. Base class-> base class member functionBase class-> base class member function Derived class-> Derived class member funDerived class-> Derived class member fun Compile time polymorphismCompile time polymorphism
16.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 16 Department of Information Technology Method Overriding Binding of Fun. Depend on type of Invoking object.Binding of Fun. Depend on type of Invoking object. p->print() call base type print function as type ofp->print() call base type print function as type of p is Base.p is Base. Binding of Fun. Depend on type of Invoking object.Binding of Fun. Depend on type of Invoking object. p->print() call base type print function as type ofp->print() call base type print function as type of p is Base.p is Base.
17.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 17 Department of Information Technology How to call derived class method using base class pointer?? Solution Run time polymorphism What it mean? Binding will done at run time Instead of compile time. What happen in Runtime binding Based on content of the object compiler will bind the function definition with specific functional call!!! How to instruct to the compiler to do binding at runtime instead of compile time By making base class function virtual. Generally referred as virtual Function!!!!
18.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 18 Department of Information Technology Method Overriding When compiler find virtual keyword in baseWhen compiler find virtual keyword in base class member function, Compiler perform runtimeclass member function, Compiler perform runtime binding instead of compile time binding.binding instead of compile time binding. Content of p is address of derived class so it callsContent of p is address of derived class so it calls print() method of derived class!!!!print() method of derived class!!!! When compiler find virtual keyword in baseWhen compiler find virtual keyword in base class member function, Compiler perform runtimeclass member function, Compiler perform runtime binding instead of compile time binding.binding instead of compile time binding. Content of p is address of derived class so it callsontent of p is address of derived class so it calls rint() method of derived class!!!!rint() method of derived class!!!!
19.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 19 Department of Information Technology Definition: Virtual Function A virtual function is a member function which is declared within base class and is re- defined (Overridden) by derived class. When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class's version of the function.
20.
Classified e-Material ©Copyrights
Charotar Institute of Technology-CHARUSAT, Changa 20 Department of Information Technology
Download now