473,241 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

dynamic binding

Hi there,

I want to learn how the compiler is implementing the dynamic binding. where
can i read about this subject (the hole process).

thanks.


Jul 22 '05 #1
2 3373
festiv wrote:
Hi there,

I want to learn how the compiler is implementing the dynamic binding. where
can i read about this subject (the hole process).


C++ uses static binding so it becomes rather difficult to describe how
it does dynamic binding. You can't say how something does a thing it
does not do :P

Objective-C is a language based on C that has dynamic binding. Maybe
you want to look into that language if you are really interested in how
it is done.

--
"I'm a war president. I make decisions here in the Oval Office
in foreign policy matters with war on my mind." - Bush

Jul 22 '05 #2
Noah Roberts wrote:
festiv wrote:

I want to learn how the compiler is implementing the dynamic binding.
where can i read about this subject (the hole process).


C++ uses static binding so it becomes rather difficult to describe how
it does dynamic binding. You can't say how something does a thing it
does not do :P


Noah,

How do you define "dynamic binding?" I've always understood the term to
mean something like "resolving a member function call at run time rather
than compile time." I would have said C++ supports dynamic binding with the
"virtual" keyword.

festiv,

If you want to know how your compiler implements virtual member functions,
then for a definitive answer you'd have to ask the people who made your
compiler. The C++ standard doesn't require any particular implementation,
although I suspect all real C++ compilers use some sort of "vtable" approach
(see link below).

One of my former professors has some lecture notes online that might
interest you. I think they'll give you an idea of what's probably happening
behind the scenes:

http://www.libertysoft.com/ggu/cis30...ymorphism.html

Unfortunately, I think his second-to-last code example has a couple of
typos. The Manager class' constructor should probably look like this:

Manager::Manager(EmployeeID const&id, StoreID const&store,
double payrate) : Employee(id, store, payrate, polys_)
{
}

or maybe

Manager::Manager(EmployeeID const&id, StoreID const&store,
double payrate) : Employee(id, store, payrate, &polys_)
{
}

depending on whether the Employee class' constructor takes a pointer to a
Polymorphics struct or a reference to a Polymorphics struct.

And the AssistantManager class' constructor should probably look something
like this:

AssistantManager::AssistantManager(EmployeeID const&id, StoreID
const&store, double payrate) : Employee(id, store, payrate, polys_)
{
}

or maybe

AssistantManager::AssistantManager(EmployeeID const&id, StoreID
const&store, double payrate) : Employee(id, store, payrate, &polys_)
{
}

--
Russell Hanneken
rg********@pobox.com
Remove the 'g' from my address to send me mail.
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: prashna | last post by:
Hi all, Is'nt a function invocation through a function pointer is dynamic binding? For example consider the following program 1 int main() 2 { 3 int (*fun_ptr)(); 4 int...
9
by: Gibby Koldenhof | last post by:
Hiya, Terrible subject but I haven't got a better term at the moment. I've been building up my own library of functionality (all nice conforming ISO C) for over 6 years and decided to adopt a...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
3
by: compgeek.320 | last post by:
Hi Everyone, Can any one explain me about Dynamic binding related to OOPs concepts.I studied in a book that the polymorphic fuction call will be decided in the runtime rather than the compile...
3
by: Colin | last post by:
Hello, I can manage quite well in ASP but would like some advice in the best way to achieve dynamic layout in ASP.NET and still keep the page and code separate. Let's say I already have a...
13
by: Jess | last post by:
Hello, I have some questions to do with dynamic binding. The example program is: #include<iostream> using namespace std; class A{
2
by: 09876 | last post by:
Hi: all I understand the difference between dynamic binding and static binding. But I just wonder what is the point to make the distinction between the dynamic binding and static binding. For...
4
by: aarklon | last post by:
Hi all, recently a friend asked me is there any dynamic binding in C...?? to which i answered AFAIK it is in C++ only, but he says it is valid in C. if dynamic can be implemented via function...
26
by: Aaron \Castironpi\ Brady | last post by:
Hello all, To me, this is a somewhat unintuitive behavior. I want to discuss the parts of it I don't understand. .... f= lambda: n .... 9 9
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.