473,910 Members | 6,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3442
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::Manage r(EmployeeID const&id, StoreID const&store,
double payrate) : Employee(id, store, payrate, polys_)
{
}

or maybe

Manager::Manage r(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 AssistantManage r class' constructor should probably look something
like this:

AssistantManage r::AssistantMan ager(EmployeeID const&id, StoreID
const&store, double payrate) : Employee(id, store, payrate, polys_)
{
}

or maybe

AssistantManage r::AssistantMan ager(EmployeeID const&id, StoreID
const&store, double payrate) : Employee(id, store, payrate, &polys_)
{
}

--
Russell Hanneken
rg********@pobo x.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
1640
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 fun(){printf("HIIIIII\n");}
9
2642
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 more OO approach to fit my needs. Altough I used an OO approach previously for some subparts of the library it became somewhat difficult to maintain all those parts since they really are the same thing coded for each part (code duplication). So...
1
7599
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 dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
3
5533
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 time. My doubt is that During compilation the data types of the arguments are known to us the compiler will store the starting address of the fuction based on the arguments Where is the concept of dynamic binding used??
3
3271
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 data source which contains a few records with a picture link and a label. That's simple so far but now I would
13
1706
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
9679
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 example, in c, if a function pointer is used. say something like that float (*pt2Func)(float, float); so the compiler doesn't know what is pt2Func to be called until at run-time. Is it dynamic binding? Thanks.
4
530
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 pointers in C , can anyone give an example for dynamic binding in C...??
26
2831
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
11349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7250
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5939
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6142
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.