mercredi 5 décembre 2018

"0xCCCCCCC" access violation reading error in class method

I am using c++ to code a trafic sim and programmed a class to represent to streets with different variables like length and speedlimit, which both are set to privat.

Now to my problem:

I am using a getter to give back the lenght of a street but instead of actually doing what the function is supposed to do, it is throwing an error for the this-pointer of the function.

The error is supposed to be an acces violation reading error at 0xCCCCCCC.

As further information: The class also has a list from the STL to hold vehicles which are curently on said road.

These vehicles have a pointer which is used to refer to an obj of another class and is initialized with NULL.

The obj which is used to call the memberfunction is created staticly (which is the reason I dont get how to fix this) with a selfprogrammed constructor.

If you need furhter information fell free to ask.

Aucun commentaire:

Enregistrer un commentaire