Here is the code. This is a class that stores points in the R^2 space.
PointSet::PointSet(const PointSet& ps)
{
if (Containment < ps.Size)
{
if (_Set != nullptr) delete[]_Set;
_Set = new Point[ps.Size];
Containment = ps.Size;
}
Size = ps.Size;
for (unsigned i = 0; i != ps.Size; ++i)
{
_Set[i] = ps._Set[i];
}
}
A 0xC0000005:Access violation writing error occured when I pass a PointSet object to a function's parameter. I wonder if it is because the parameter stores in the function's stack and there is not efficient space for the PointSet object(stackoverflow?lol)? But I think the keyword new won't allocate space in the stack. So I am confused, why is this error happend? Thanks!