C++???????????????
???????????? ???????[ 2014/1/9 13:45:55 ] ????????C++ ???? ??
????3??????????????????????????????????й????????????????????????????????????н????????????????????????????????????????????£?
class MyTest_Base
{
public:
MyTest_Base (string name = "") : m_name(name)
{
cout << "???????MyTest_Base?????????????????"<<m_name << endl;
}
virtual ~ MyTest_Base ()
{
cout << "???????MyTest_Base?????????????????"<<m_name << endl;
}
void Func() throw()
{
throw std::exception("???????????????????");
}
void Other() {}
protected:
string m_name;
};
class MyTest_Parts
{
public:
MyTest_Parts ()
{
cout << "???????MyTest_Parts????????" << endl;
}
virtual ~ MyTest_Parts ()
{
cout << "???????MyTest_Parts????????"<< endl;
}
};
class MyTest_Derive : public MyTest_Base
{
public:
MyTest_Derive (string name = "") : m_component()?? MyTest_Base(name)
{
throw std::exception("??MyTest_Derive????????????????????????");
cout << "???????MyTest_Derive?????????????????"<<m_name << endl;
}
virtual ~ MyTest_Derive ()
{
cout << "???????MyTest_Derive?????????????????"<<m_name << endl;
}
protected:
MyTest_Parts m_component;
};
void main()
{
try
{
// ????????????????
MyTest_Derive obj1("obj1");
obj1.Func();
obj1.Other();
}
catch(std::exception e)
{
cout << e.what() << endl;
}
catch(...)
{
cout << "unknow exception"<< endl;
}
}
???????????е??????
???????????MyTest_Base?????????????????obj1
???????????MyTest_Parts????????
???????????MyTest_Parts????????
???????????MyTest_Base?????????????????obj1
??????MyTest_Derive????????????????????????
????????????????У?MyTest_Derive??MyTest_Base??У???MyTest_Derive???????MyTest_Parts?????????????????MyTest_Derive???????????????MyTest_Base?????????MyTest_Parts???????????m_component????????????????????????????????????????????????????????????????????????????????л???????????????????????????????Щ???е???????漲?????????????????Щ?????е??κ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????н??????ó?????????
??????1?? ????????????????????????????????????????????????????????????????
??????2?? ?????????????????????????????????????????????????????????????????????????п???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????е??
???????????????????????????
??????1?? C++?????????????????????????????????????
??????2?? ?????????????????????????????????????У?
??????3?? ????????????????????????????????????????????????
??????4?? ????^-^???????????仰?? “C++???????????????κ?????????????????”????????????????ν?????????????μ?????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11