后期绑定问题!
我在一次采访中被问到这个问题。
据我所知,后期绑定是在运行时动态识别符号。如果我错了,请纠正我。
有人问我一个问题,比如当我们在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
即使您有函数指针,也会使用后期绑定。
后期绑定是运行时多态性。它基本上意味着与虚函数相关的问题。
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.
后期绑定要求开发人员自己指定函数签名,因为编译器无法像往常一样进行验证。此外,需要使用正确的数据类型来防止堆栈损坏。
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.
优点:
缺点:
Advantages:
Disadvantage:
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.