小编sly*_*fox的帖子

在C++中延迟类定义中的数组大小?

有没有办法延迟定义数组的大小,直到类方法或构造函数?

我在想什么可能看起来像这样,当然,它不起作用:

class Test
{
    private:
    int _array[][];

    public:
    Test::Test(int width, int height);
};

Test::Test(int width, int height)
{
    _array[width][height];
}
Run Code Online (Sandbox Code Playgroud)

c++ arrays size delay

5
推荐指数
2
解决办法
6205
查看次数

标签 统计

arrays ×1

c++ ×1

delay ×1

size ×1