المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Memory read - write error



C++ Programming
05-05-2010, 02:20 PM
Hi,
I have lots of class and I have a problem. This is,

"An unhandled exception of type 'System.AccessViolationException' occurred in TrafficSim.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I have classes and their functions.

class FollowAgent

class CreateAgent
{
FollowAgent* dFollowAgent
}

class DriveAgent
{
dCreateAgent = new CreateAgent(...);
...........
dCreateAgent->dFollowAgent= new FollowAgent(...);
}

I think the error is about usage of "dCreateAgent->dFollowAgent". if I use as "dFollowAgent= new FollowAgent(...);" it works normally, but is not my aim.

How can I solve this problem?

Have a good work!