Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 848091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:53:21+00:00 2026-05-15T06:53:21+00:00

I was looking for some information about virtual tables, but I can’t find anything

  • 0

I was looking for some information about virtual tables, but I can’t find anything that is easy to understand.

Can somebody give me good examples with explanations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:53:22+00:00Added an answer on May 15, 2026 at 6:53 am

    Without virtual tables you wouldn’t be able to make runtime polymorphism work since all references to functions would be bound at compile time. A simple example

    struct Base {
      virtual void f() { }
    };
    
    struct Derived : public Base {
      virtual void f() { }
    };
    
    void callF( Base *o ) {
      o->f();
    }
    
    int main() {
      Derived d;
      callF( &d );
    }
    

    Inside the function callF, you only know that o points to a Base object. However, at runtime, the code should call Derived::f (since Base::f is virtual). At compile time, the compiler can’t know which code is going to be executed by the o->f() call since it doesn’t know what o points to.

    Hence, you need something called a “virtual table” which is basically a table of function pointers. Each object that has virtual functions has a “v-table pointer” that points to the virtual table for objects of its type.

    The code in the callF function above then only needs to look up the entry for Base::f in the virtual table (which it finds based on the v-table pointer in the object), and then it calls the function that table entry points to. That might be Base::f but it is also possible that it points to something else – Derived::f, for instance.

    This means that due to the virtual table, you’re able to have polymorphism at runtime because the actual function being called is determined at runtime by looking up a function pointer in the virtual table and then calling the function via that pointer – instead of calling the function directly (as is the case for non-virtual functions).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for some information about the roll-out of a python project that uses
I'm looking to store some information about the the timezone that the user is
I looking for some information about the difference of the different session types available
I've been looking for some mechanism through which I can fetch android app's information
After looking around for some information about managing my azure app i found csmanage
I am looking for some good resources of information about the CorDbg & Mdbg
I was looking for some technical information about how RequestInterceptor from the WCF REST
I was just looking through some information about Google's protocol buffers data interchange format.
Where can I find some information on the uses and benefits of an enterprise
I've tried looking for some information about a query I'm trying to write and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.