//-------------------------------------------
//程序作者:申志远 2013/01/17 16:44:01
//函数功能:你最应该上机运行的代码系列
//参数说明: 看不懂下面代码的同志应该去补习班了。
//注意事项:
//-------------------------------------------
#include <iostream>
#include <cstddef>
#include <string>
using namespace std;
class A
{
public:
// 一个C++函数能支持多少修饰符?
inline volatile virtual const void tell(const int b) const throw()
{
cout << "Who am i" << b << endl;
}
catch(...)
{
cout<< "tell function Exception catch!" << endl;
}
A() throw()
{
cout << "A() called" << endl;
}
catch(...)
{
cout << "Exceptional..."<< endl;
}
A(int a) throw()
{
cout << "A(a) called" << a << endl;
}
virtual ~A()
{
cout << "~A() called" << endl;
}
};
int main()
{
cout<< "Hello"<<endl;
// 构造一个临时对象,调用完函数后立即析构掉。
A(23).tell(2);
cout<< "World"<<endl;
return 0;
}
你最应该上机运行的C++代码系列001
最新推荐文章于 2023-04-04 17:56:02 发布