📄 cppsafedivide.h
字号:
//
// FILE: CppSafeDivide.h
//
// Copyright (c) 1997 by Aaron Michael Cohen and Mike Woodring
//
/////////////////////////////////////////////////////////////////////////
#ifndef __CppSafeDivide__
#define __CppSafeDivide__
// CWin32Exception
//
// A C++ object that is thrown in response to a Win32 exception
// and that can be caught C++ style.
//
class CWin32Exception
{
public:
CWin32Exception( unsigned int ExceptionCode )
: m_ExceptionCode(ExceptionCode)
{
}
unsigned int GetCode( void )
{
return(m_ExceptionCode);
}
virtual char *GetText( void )
{
return("unhandled exception");
}
private:
unsigned int m_ExceptionCode;
};
// CIntDivideByZero
//
// A derivation of CWin32Exception that overrides the
// GetText virtual function to announce that a divide
// by zero exception occurred.
//
class CIntDivideByZero : public CWin32Exception
{
public:
CIntDivideByZero( unsigned int ExceptionCode )
: CWin32Exception(ExceptionCode)
{
}
virtual char *GetText( void )
{
return("divide by zero");
}
};
#endif // __CppSafeDivide__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -