Method called on freed object

From Appmethod Topics
Jump to: navigation, search

Go Up to CodeGuard Errors Index

The Method Called On Freed Object error is similar to the Access In Freed Memory error, but is caused by a call to a method in a freed object rather than accessing memory, as such.

#pragma hdrstop
#include <tchar.h>
#pragma argsused
class someclass{
	int fnumber;
	int getnumber(){return fnumber;}
	void setnumber(int nw){fnumber = nw;}
	int doublev(int val){return val*2;}
	int publicalval;


void myf()
  someclass *myc = new someclass();
  delete myc;
  myc->doublev(5); // error

int _tmain(int argc, _TCHAR* argv[])
	return 0;