137.CPP自带异常
2024-08-28 22:25:18
#include <iostream>
#include <exception>
using namespace std; //继承自带的异常
class sizeerror :public exception
{
public:
sizeerror() :exception("尺寸大小异常")
{ } const char *what()
{
char *p = "尺寸大小异常";
cout << "尺寸大小异常" << endl;
return p;
}
}; class print3d
{
public:
print3d(double size)
{
if (size > )
{
throw &sizeerror();
}
}
};
void main()
{
try
{
print3d p();
}
catch (sizeerror *p)
{
p->what();
}
cin.get();
}
最新文章
- 【转】ubuntu下最好用的输入法fcitx-sunpinyin
- AE开发能否实现TOC Control里添加多个Data Frame
- Windows平台下PHP环境搭建
- linux下配置ssledge代理服务器
- XMl的解析
- android gallery 自定义边框+幻灯片
- WCF的行为与异常-------配置文件说明
- [Webpack 2] Grouping vendor files with the Webpack CommonsChunkPlugin
- Android - This Handler class should be static or leaks might occur.
- [ERROR] Unknown/unsupported storage engine: InnoDB
- PHP学习笔记-3
- 【leetcode81】Product of Array Except Self
- 关于maven项目的servlet-api的问题
- c# 数据存储过程
- [luogu P1552] [APIO2012]派遣
- SQL SERVER 2008自动发送邮件(完整版)
- 使用用WCF中的双工(Duplex)模式将广告图片推送到每个Winform客户端机子上
- 设计模式19:Chain Of Responsibility 职责链模式(行为型模式)
- Python 邮件发送消息
- SpringBoot13 利用mybatis-plus自动生成entity、dao、service、controller
热门文章
- Ubuntu 16.04 安装 Wireshark分析tcpdump的pcap包——sudo apt install wireshark-qt
- poj--1236--Network of Schools(scc+缩点)
- Oracle RAC 全局等待事件 gc current block busy 和 gc cr multi block request 说明--转载(http://blog.csdn.net/tianlesoftware/article/details/7777511)
- Python使用functools模块中的partial函数生成偏函数
- C#.NET编码规范
- PHP 导出excel 数据量大时
- 关于requestAnimationFrame()和cancelAnimationFrame()与定时器之间的比较
- Android 对ScrollView滚动监听,实现美团、大众点评的购买悬浮效果
- SQL Server的复合索引学习【转载】
- Android回炉系列之四大组件之首Activity