I'm trying to learn C++ currently, but I'm having issues with the code below.
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 throws throw the following error when calling getSdlOffset()
An unhandled exception of type 'System.AccessViolationException' occurred in crossEchoTest.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I've got a C#/java background, and I'm lost... Any help would be much appreciated.