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

  • Home
  • SEARCH
  • 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 7195169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:31:29+00:00 2026-05-28T20:31:29+00:00

In dynamic binding , the function call is bound to the function implementation based

  • 0

In dynamic binding, the function call is bound to the function implementation based on the type of object to which the pointer is pointing to.

Suppose we have the following code :

base *bptr = new derived;
bptr->func();

Let the function func be declared virtual in the base class. Then the derived class’s version of virtual function func will be invoked at run-time due to dynamic binding.

I understand the above concept.

But i got confused by the following concept which i studied after studying the above concept.

In the above code snippet, a pointer to derived class object is implicitly converted to a pointer to base class object. Then bptr will be actually pointing to the base class sub-object of derived class object and not pointing to the derived class object.

Since the base class pointer bptr is pointing to base class sub-object, during run-time shouldn’t the base class’s version of virtual function func be invoked?

  • 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-28T20:31:30+00:00Added an answer on May 28, 2026 at 8:31 pm

    It seems that you are missing what dynamic binding actually means. It means exactly that even if the pointer (statically) refers to the base sub object the call will be dispatched to the (dynamic) type of the complete object.

    The common implementation is by means of a virtual function table. The base sub object will store as a hidden member a pointer to the virtual function table of the actual complete type to which it belongs. All calls to virtual functions (for which dynamic dispatch is not disabled) are routed through that extra level of indirection ensuring that the final overrides will be called.

    As to the specifics of how that table and the hidden pointer are managed, the compiler builds e tables for each type with virtual functions, and injects code to the different constructors to update the pointers accordingly. So while building the base subobject the pointer refers to the base vtable, but before entering the derived constructor the injected code will update the pointer (in base) to refer to the derived vtable.

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

Sidebar

Related Questions

I have this question about c# language's dynamic binding behavior. Consider the following object
I have a template function which accepts a function-object ('functor') as a template parameter:
I understand how the implementation of dynamic binding works and also the difference between
Dynamic Data question: I have 2 fields of type Nullable<DateTime> on my model When
I am used to doing dynamic Binding in PHP this way function ($className) {
I have an MVC masterpage set up which loads a dynamic menu using AJAX
http://jsfiddle.net/motocomdigital/c8Mey/1/ I'm using a twitter script which i'm binding a function to get the
I know that in case of dynamic binding only those method which are present
In C++, does Run-Time Type Information (RTTI) mean dynamic binding?
What is the type of the exception object in the following thrown: Question1> range_error

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.