operator new delete操作符重载

#include <iostream>
using namespace std;
typedef const char* FX_LPCSTR;
class CFX_Object
{
  public:
  void* operator new(size_t size, FX_LPCSTR file, int line)
  {
    return malloc(size);
  }
  
  void operator delete(void*p,FX_LPCSTR file,int size)
  {
    free(p);
  }
  
};
int main()
{
  cout << "Hello, World!" << endl;
  return 0;
}
 

  

上一篇:CFX_StringData


下一篇:js中的foreach用法