摘要: 根本原因一句话 执行父类构造函数期间,对象的 vptr 指向【父类虚表】,尚未更新为子类虚表;动态绑定依赖vptr,因此只能调用父类版本,无法触发子类重写函数。 完整时序(Base <- Derived) Derived d; 开辟内存(原始内存,无有效vptr) 调用 Base::Base() ✅ 阅读全文
posted @ 2024-01-01 00:01 hellsino 阅读(11) 评论(0) 推荐(0)
摘要: 28 阅读全文
posted @ 2023-12-31 23:59 hellsino 阅读(15) 评论(0) 推荐(0)
摘要: 27 阅读全文
posted @ 2023-12-31 22:00 hellsino 阅读(13) 评论(0) 推荐(0)
摘要: 26 阅读全文
posted @ 2022-12-01 18:52 hellsino 阅读(42) 评论(0) 推荐(0)
摘要: 25 阅读全文
posted @ 2022-11-05 23:18 hellsino 阅读(100) 评论(0) 推荐(0)
摘要: 24 阅读全文
posted @ 2022-11-05 09:59 hellsino 阅读(84) 评论(0) 推荐(0)
摘要: 23 阅读全文
posted @ 2022-11-02 22:08 hellsino 阅读(108) 评论(0) 推荐(0)
摘要: 22 阅读全文
posted @ 2022-11-01 12:00 hellsino 阅读(15) 评论(0) 推荐(0)
摘要: 21 阅读全文
posted @ 2022-10-28 14:02 hellsino 阅读(324) 评论(0) 推荐(0)
摘要: 20 阅读全文
posted @ 2022-10-25 10:01 hellsino 阅读(68) 评论(0) 推荐(0)