看看这段异常代码,在线等?
//a.h 中
#include <iostream>
using namespace std;
class animal
{
public:
animal();
animal(int _age);
void cry();
void virtual run();
private:
int _name;
int _age;
};
animal::animal()
{
cout<<"this is a anmiam"<<endl;
}
animal::animal(int _age)
{
cout<<"the animal age is "<<_age<<endl;
if(_age>60)
throw animal(_age);
}
void animal::cry()
{
cout<<"zhe animal is cry"<<endl;
}
void animal::run()
{
cout<<"the animal is run()"<<endl;
}
class dog : public animal
{
public:
dog();
void cry();
void virtual run();
private:
int zl;
};
dog::dog()
{
cout<<"this is a dog!"<<endl;
}
void dog::cry()
{
cout<<"zhe dog is cry"<<endl;
}
void dog::run()
{
cout<<"zhe dong is run"<<endl;
}
// a.cpp 中
#include <iostream>
#include <string>
#include "a.h"
using namespace std;
void main()
{
try
{
animal an(90);
}
catch(const animal & a)
{
cout<<"animal is ex"<<endl;
}
catch(const dog & d)
{
cout<<"dog is ex"<<endl;
}
}
为什么 运行后 是个死循环?
#include <iostream>
using namespace std;
class animal
{
public:
animal();
animal(int _age);
void cry();
void virtual run();
private:
int _name;
int _age;
};
animal::animal()
{
cout<<"this is a anmiam"<<endl;
}
animal::animal(int _age)
{
cout<<"the animal age is "<<_age<<endl;
if(_age>60)
throw animal(_age);
}
void animal::cry()
{
cout<<"zhe animal is cry"<<endl;
}
void animal::run()
{
cout<<"the animal is run()"<<endl;
}
class dog : public animal
{
public:
dog();
void cry();
void virtual run();
private:
int zl;
};
dog::dog()
{
cout<<"this is a dog!"<<endl;
}
void dog::cry()
{
cout<<"zhe dog is cry"<<endl;
}
void dog::run()
{
cout<<"zhe dong is run"<<endl;
}
// a.cpp 中
#include <iostream>
#include <string>
#include "a.h"
using namespace std;
void main()
{
try
{
animal an(90);
}
catch(const animal & a)
{
cout<<"animal is ex"<<endl;
}
catch(const dog & d)
{
cout<<"dog is ex"<<endl;
}
}
为什么 运行后 是个死循环?
...全文
相关推荐
29Linux基础命令详解——用户管理.docx
29Linux基础命令详解——用户管理
科技服务机构如何通过数据分析增强服务竞争力?.docx
科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。
vue+springboot基于 Java 的南昌实利广告公司的员工管理系统的设计与实现_oj680rl3毕业设计源码数据库.zip
vue+springboot基于 Java 的南昌实利广告公司的员工管理系统的设计与实现_oj680rl3毕业设计源码数据库.zip
车辆缺陷分割数据集4000张json格式.zip
数据集格式:labelme格式(不包含mask文件,仅仅包含jpg图片和对应的json文件) 图片数量(jpg文件个数):4000 标注数量(json文件个数):4000 标注类别数:1 标注类别名称:["defect"] 每个类别标注的框数: defect count = 8740 总框数:8740 使用标注工具:labelme=5.5.0 所在仓库:firc-dataset 图片分辨率:640x640 标注规则:对类别进行画多边形框polygon 重要说明:可以将数据集用labelme打开编辑,json数据集需自己转成mask或者yolo格式或者coco格式作语义分割或者实例分割 特别声明:本数据集不对训练的模型或者权重文件精度作任何保证
高校如何利用技术转移服务转化科研成果并提升影响力?.docx
高校如何利用技术转移服务转化科研成果并提升影响力?


