且构网

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

抽象类和指针

更新时间:2023-01-11 10:05:47

如果你想要容器项目的多态行为,你别无选择,只能使用指针。为了让你的生活尽可能简单,你应该使用智能指针,如 shared_ptr< Foo>

If you want polymorphic behaviour for container items, you have no choice but to use pointers. To make your life as easy as possible, you should use smart pointers, such as shared_ptr<Foo>.