且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

销毁派生类后使用基类的成员

更新时间:2023-02-15 15:45:33

我认为您的方法不好.注释中有一个不错的链接,该链接显示了有关标准细节的辩论.一旦争论不休,很有可能不同的编译器将以不同的方式实现此细节.更.同一编译器可能会将其实现方式从一个版本更改为另一个版本.

I believe that your approach is bad. There is a nice link in comments that shows debate about the details of the standard. Once there is a debate there is good chance that different compilers will implement this detail differently. Even more. The same compiler may change its implementation from one version to another.

您越用不同的暗角,遇到问题的机会就越大.

The more you use various dark corners, the bigger is the chance that you will meet with problems.

底线.愿意实现什么?为什么不能使用普通的C ++语言功能来做到这一点?

Bottom line. What are willing to achieve? Why can't you do this using ordinary C++ language features?