捆绑 [英] Binding

查看:82
本文介绍了捆绑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



什么是早期/晚期绑定?

Hi,
What is early/late binding ?

推荐答案

Tom Gur写道:
Tom Gur wrote:

什么是早期/晚期绑定?
What is early/late binding ?



我认为它是代码中函数地址的分辨率

函数是(是)叫。早期绑定(称为QUOT;静"

或"编译时"或&]连结时"粘合剂)指分辨基于该类型的地址

编译时可用的信息。后期绑定

(也称为动态绑定或运行时绑定)表示根据运行时[仅]可用的类型信息解析

地址

取决于编译时未知的某些条件。


维基百科说什么?


V

-

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问

I think it''s the resolution of function address(es) in the code where
the function(s) is (are) called. Early binding (referred to as "static"
or "compile-time" or "link-time" binding) means resolving the address
based on the type information available at compile time. Late binding
(also "dynamic binding" or "run-time binding") means resolving the
address based on type information available [only] at run time and
depending on some condition not known at compile-time.

What does Wikipedia say?

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


7月30日下午4:04,Tom Gur< gur .... @ gmail.comwrote:
On Jul 30, 4:04 pm, Tom Gur <gur....@gmail.comwrote:



什么是早期/晚期绑定?
Hi,
What is early/late binding ?



后期绑定是涉及调用通常被称为虚拟的东西的东西。其他东西通常是早期绑定的.Late

绑定是关于确定在运行时调用的函数

为时已晚,不能为错误而后悔。


问候,

FM。

late binding is something involving calling things which are usually
declared as ''virtual''.other things are usually early binded.Late
binding is about determining the function to be called at runtime
which is too late to be sorry about mistakes.

regards,
FM.


7月30日下午6:04,Tom Gur< gur .... @ gmail .comwrote:
On Jul 30, 6:04 pm, Tom Gur <gur....@gmail.comwrote:



什么是早期/晚期绑定?
Hi,
What is early/late binding ?



从一般意义上讲,绑定时间是指指的是

标识符/变量绑定到值的时间。早期绑定,也称为

" static binding"或编译时绑定或指的是

标识符在编译时绑定到值的事实。运行时

绑定/动态绑定/后期绑定是指

绑定延迟到运行时的事实。


当然,''绑定''不应与''更改

值'混淆。


在C ++中,虚函数遵循后期绑定。非虚拟功能

遵循早期绑定。另一方面,所有变量都是_always_

早期约束。这可以从以下示例中看出:


struct A

{

int i;

A():i(10){}

virtual void foo();

};


struct B:公共A

{

int i;

B():i(20){}

void foo ();

};


int main()

{

A * a = new B();

int s = a-> i; // s的值是10而不是20:早期绑定

a-> foo(); //调用B :: foo():后期绑定

}


-

In a very general sense, "binding time" refers to the time where
identifiers/variables are bound to values. Early binding, also called
"static binding" or "compile time binding" refers to the fact that
identifiers get bound to the values at compile time. Run-time
binding / dynamic binding / late binding refers to the fact that the
binding is delayed till run time.

of course, ''Binding'' should not be confused with ''changing the
value'' .

In C++, virtual functions follow late binding. Non virtual functions
follow early binding. On the other hand, all variables are _always_
early bound. This can be seen from the following example:

struct A
{
int i;
A() : i(10) { }
virtual void foo();
};

struct B: public A
{
int i;
B(): i(20) { }
void foo();
};

int main()
{
A* a = new B();
int s = a->i; // value of s is 10 not 20 : early binding
a->foo(); // calls B::foo() : late binding
}

-N

这篇关于捆绑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆