我有一个类Pixel
和类Image
与一个函数用于更新像素线。我想初始化像素线。我的问题是初始化数组。其实我有这样的:指针 - 初始化元素
bool UpdateLine(Pixel line[], int nb)
{
bool noError = true;
line = new Pixel[nb];
for (int r = 0; r < nb; r++)
{
line[r] = new Pixel(); // -> line causing troubles
// do some stuff with my pixel
[...]
}
return noError;
}
当我试试这个,我有:
没有可行的重载 '='
我如何初始化我的数组元素每一个?
'line'是一个对象数组!他们都已经建成。 C++对C#或Java的工作方式不同。 [一本好书或两个是必须的,我想。(https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) – StoryTeller