【发布时间】:2011-01-29 17:27:06
【问题描述】:
我目前正在尝试学习 C++,但我在使用下面的代码时遇到了问题。
class Vector2
{
public:
double X;
double Y;
Vector2(double X, double Y)
{
this->X = X;
this->Y = Y;
};
SDL_Rect * getSdlOffset()
{
SDL_Rect * offset = new SDL_Rect();
offset->x = this->X;
offset->y = this->Y;
return offset;
};
};
Visual Studio 在调用 getSdlOffset() 时抛出以下错误
未处理的类型异常 'System.AccessViolationException' 发生在crossEchoTest.exe中
其他信息:已尝试 读或写受保护的内存。这 通常表明其他 内存已损坏。
我有 C#/java 背景,但我迷路了...任何帮助将不胜感激。
【问题讨论】: