文件名称:抛出异常类-Windows编程基础
文件大小:547KB
文件格式:PPT
更新时间:2024-05-13 11:06:31
Windows
2.抛出异常类 bool CDate::checkDate(bool bException){ bool rt=true; if (year<=0){ rt=false; if (bException&&(!rt)) throw CDateException("year's Exception occurred"); year=1900; } if ((month<=0)||(month>12)){ rt=false; if (bException&&(!rt)) throw CDateException("month's Exception occurred"); month=1; } if (day>maxDay()){ rt=false; if (bException&&(!rt)) throw CDateException("day's Exception occurred"); day=1; } return rt; }