#include <iostream>
#include <vector>
#include <tuple>
#include <bitset>
#include <regex>
#include <random>
using namespace std;
void exceptionTest();
int main()
{
exceptionTest();
cout << "enter key" << endl;
while (cin.get() != EOF)
{
}
return 0;
}
void exceptionTest()
{
try
{
int n = 0;
if (n < 0)
throw logic_error("逻辑错误,n必须大于0");
}
catch (runtime_error error)
{
}
catch (logic_error error)
{
cout << error.what() << endl;
}
catch (exception error)
{
}
}
void exceptionfun1() noexcept {};
void exceptionfun2() noexcept(noexcept(exceptionfun1)) { exceptionfun1(); };
#ifndef Pack_H
#define Pack_H
#include <iostream>
#include <string>
namespace Sales
{
class Pack
{
private:
public:
};
void Fun1();
inline namespace Sales_Sub{
void Fun2();
}
}
void Sales::Fun1(){};
void Sales::Fun2(){};
void Fun3(){
using Sales::Fun1;
using namespace Sales;
}
void Fun4(){
std::string s = "aa";
operator>>(std::cin, s);
}
#endif
#ifndef Programmer_H
#define Programmer_H
#include <string>
class Programmer
{
private:
public:
};
class FrontEnd : public virtual Programmer
{
public:
std::string GetName(){ return "FrontEnd"; };
};
class BackEnd : public virtual Programmer
{
public:
std::string GetName(){ return "BackEnd"; };
};
class FullStack : public FrontEnd, public BackEnd
{
private:
public:
FullStack() : Programmer(), FrontEnd(), BackEnd(){};
std::string GetName(){
return FrontEnd::GetName() + "+" + BackEnd::GetName();
};
};
#endif