??Ч??????????й??????
???????????? ???????[ 2013/1/14 10:26:04 ] ????????
??????????????????????Щ???????????????????????Ч????д????????????й????????????????????????????δ???
class Image
{
public:
Image(const std::string& imgFileName);
...
}
class Voice
{
public:
Voice(const std::string& vFileName);
...
}
class People
{
public:
People(const std::string& n??const int& a??const int& h??const std::stirng& imgFileName??const std::string& vFileName);
~People( );
private:
string name;
int age;
int height;
Image *pImg; //???
Voice *pVoi; //????
};
People::People( const std::string& n??const int& a??const int& h??const std::stirng& imgFileName??const std::string& vFileName )
:name(n)??age(a)??height(h)??pImg(0)??pVoi(0)
{
if(imgFileName != "")
{
pImg = new Image( imgFileName ) ;
}
if(vFileName != " ")
{
pVoi = new Voice ( vFileName );
}
}
People::~People( )
{
delete pImg;
delete pVoi;
}
??????????????????????????????????????People?????????????治???????????棩?????????????????????????????????????????????????????????????Image????????????Voice??????????????????????????????????????????????????????У????pImg???????????治???????????????????й????????????????
...
People *p =NULL;
try{
p=new People("test"??20??170??".../images/image01.jpg"??"../voices/voice01.dat");
...
catch( ... ){
delete p;
throw;
}
delete p;
}
??????????? new People("test"??20??170??".../images/image01.jpg"??"../voices/voice01.dat")????????Image???????汻????????new??????г????????????p???и????????????catch????????κβ????????????????涪????
?????????????????????????C++??????????????????????????????????????????????????????????????????????檔
People::People( const std::string& n??const int& a??const int& h??const std::stirng& imgFileName??const std::string& vFileName )
:name(n)??age(a)??height(h)??pImg(0)??pVoi(0)
{
try {
if(imgFileName != "")
{
pImg = new Image( imgFileName ) ;
}
if(vFileName != " ")
{
pVoi = new Voice ( vFileName );
}
}
catch( ...) {
delete pImg ;
delete pVoi;
throw ;
??????
???·???
??????????????????
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