CFX_BasicArray

// 你必须定义一个 `main()` 函数入口。
#include <iostream>
using namespace std;
#include <string.h>
 typedef const char* FX_LPCSTR;
typedef char FX_CHAR;
typedef int FX_STRSIZE;
typedef int FX_BOOL;
typedef unsigned char FX_BYTE;
typedef unsigned char *FX_LPBYTE;
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);
  }
  void* operator new(size_t size)
  {
    return malloc(size);
  }
  void operator delete(void* p)
  {
    free(p);
  }
    void*			operator new[] (size_t size, FX_LPCSTR file, int line)
    {
        return malloc(size);
    }
    void			operator delete[] (void* p, FX_LPCSTR file, int line)
    {
        free(p);
    }
    void*			operator new[] (size_t size)
    {
        return malloc(size);
    }
    void			operator delete[] (void* p)
    {
        free(p);
    }
    void*			operator new (size_t, void* buf)
    {
        return buf;
    }
    void			operator delete (void*, void*)							{}
};
class CFX_BasicArray : public CFX_Object
{
   protected:
    CFX_BasicArray(int unit_size);

    ~CFX_BasicArray();
 
 protected:

    FX_LPBYTE		m_pData;

    int				m_nSize;

    int				m_nMaxSize;

    int				m_nUnitSize;
    
};
#define FX_Free free
CFX_BasicArray::CFX_BasicArray(int unit_size)
    : m_pData(NULL)
    , m_nSize(0)
    , m_nMaxSize(0)
{
    if (unit_size < 0 || unit_size > (1 << 28)) {
        m_nUnitSize = 4;
    } else {
        m_nUnitSize = unit_size;
    }
}
CFX_BasicArray::~CFX_BasicArray()
{
    FX_Free(m_pData);
}

int main()
{
  cout<<"hello,world"<<endl;
  return 0;
}
 
		

  

上一篇:https ; 及https证书


下一篇:类的构造函数 类型一样 变量名不一样无所谓