小编Mat*_*Mat的帖子

c ++将vector <Inherited*>转换为vector <abstract*>

class Interface{};

class Foo: public Interface{};

class Bar{
public:
    vector<Interface*> getStuff();
private:
    vector<Foo*> stuff;
};
Run Code Online (Sandbox Code Playgroud)

我该如何实现这个功能getStuff()

c++ polymorphism casting vector

8
推荐指数
2
解决办法
4638
查看次数

标签 统计

c++ ×1

casting ×1

polymorphism ×1

vector ×1