有关引用和模板的一个问题?

wzgjsj 2001-12-20 05:03:31
有下面一个程序:
#include "iostream.h"
void throw_test(int);
class ob
{
public: int member;
};
int main()
{int flag=2;
try{ throw_test(flag);
}
catch(const char *p)
{cout<<"into character catch-handler"<<endl;
cout<<"member value is"<<ob_inst.member<<endl;
return(0);
}
void throw_test(int flag)
{if(flag==1)
throw "panic!!!";
else
if(flag==2)
{ob ob_inst;
ob_inst.member=5
throw ob_inst;
}
}
请解释一下里面的引用和模板(有分得!!!!!).
...全文
31 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
北极猩猩 2001-12-20
  • 打赏
  • 举报
回复
谁说没有?
cout就是个模板的实例。
还有
cout<<"into character catch-handler"<<endl;
cout<<"member value is"<<ob_inst.member<<endl;
每一个"<<"都会导致一个函数调用,返回值都是引用。

andy_lau 2001-12-20
  • 打赏
  • 举报
回复
这里没有你说的所谓的引用和模板阿

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧