16,011,374 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 13913102 (Top 4 by date)
Member 13913102
23-Nov-18 4:10am
View
yes I agree with you. This means first compiler should agree it, vtable comes in picture at runtime.
Thx for your valuable comments and answers.
Member 13913102
23-Nov-18 4:01am
View
vtable explanation which I learnt is here:
http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/
Member 13913102
23-Nov-18 3:59am
View
yes I missed on polymorphism, but see this link, it says __vptr will point to __vtable of derived class, and this __vtable will have pointer to func_2, then it must be accessed.
http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/
Member 13913102
23-Nov-18 3:00am
View
thx for your detailed explanation, I will go thru your answer again, I still have few doubts.
If in base class I rename func_1 as func_2, then this will work fine and derived class function will be called, as concepts of __vtable and __vptr make it happen. __vptr will have address of __vtable of derived class.
But before renaming func_1 to func_2(in original code), why __vptr was not able to find virtual func_2
vtable explanation which I learnt is here:
http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/