class TS:public TSB
{
public:
TS()
{
cout<<"TS()"<<endl;
}
//-------------->
TS(const TSB&other)
{
cout<<"TS(const TSB&other)"<<endl;
}
TS(const TS&other)
{
cout<<"TS(const TS&other)"<<endl;
}
~TS()
{
cout<<"~TS()"<<endl;
}
};
TSB fnbase()
{
return TSB();
}
//-------------->
TS fn()
{
//in gcc 4.2.2, the following statement will cause compiling error.
//but it works in gcc 3.4
return TS(fnbase());
}
int main()
{
TS ts = fn();
return 0;
}