后期绑定问题!

发布于 2024-09-05 01:00:39 字数 167 浏览 6 评论 0原文

我在一次采访中被问到这个问题。

据我所知,后期绑定是在运行时动态识别符号。如果我错了,请纠正我。

有人问我一个问题,比如当我们在 C++ 中使用后期绑定时我们会面临哪些问题。我实际上对此没有自己的想法。

您能分享一下您在职业生涯中可能遇到的问题吗?

谢谢。

i was asked this question in an interview.

late binding is dynamically identifying the symbol during the runtime as far as my knowledge is concerned.please correct me if i am wrong.

i was asked a question like what are some of the problem that we would face when we use late binding in c++. i was actually out of my own ideas about that.

could you please share the problems you might have faced during your professional life.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深海蓝天 2024-09-12 01:00:39

即使您有函数指针,也会使用后期绑定。
后期绑定是运行时多态性。它基本上意味着与虚函数相关的问题。

http://www.learncpp.com/cpp -教程/124-早期绑定和后期绑定/
链接为您提供您需要了解的一切。

Even when you have function pointers late binding is used.
Late binding is runtime polymorphism. It basically means problems associated with virtual functions.

http://www.learncpp.com/cpp-tutorial/124-early-binding-and-late-binding/
Link provides you with all you need to know.

猫性小仙女 2024-09-12 01:00:39

后期绑定要求开发人员自己指定函数签名,因为编译器无法像往常一样进行验证。此外,需要使用正确的数据类型来防止堆栈损坏。

Late binding requires the developer to specify the function signatures themselves as compiler is unable to validate as usual. Also, correct data types need to be used to prevent stack corruption.

鹤仙姿 2024-09-12 01:00:39

优点:

  • 符合开闭原则:可以在不改变现有代码的情况下用新指令扩展代码。

缺点:

  • 需要编写更多代码
  • 无法内联

Advantages:

  • In accordance with the Open-Closed Principle: the code can be extended with new instruction without changing existing code.

Disadvantage:

  • More code to write
  • Cannot be inlined
ゝ偶尔ゞ 2024-09-12 01:00:39

1.你不能创建一个可以绑定到不同类型对象的通用对象。
2.它很容易出错,并且您在编码时不会享受太多智能感知。

1.You cannot create a generic object which may be bound to different types of objects.
2.It is error prone and you will not enjoy much intellisense whilst coding.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文