03_C+ Basics Ⅰ.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
03 C++ Basics Ⅰ Usage of Pointer to functions Simply code Like “hook” Exception Specifications Throwing or catching an exception affects the way a function relates to other functions. It can therefore be worthwhile to specify the set of exceptions that might be thrown as part of the function declaration. For example: void f(int a) throw (x2, x3); The most important advantage is that the function declaration belongs to an interface that is visible to its callers. 圣警阎逃鲜庶具遇狱潞翠惕栏鼓洛佬酣诡月郑睁蛹丢葬递受斌柞节妥伎拨03_C+ Basics Ⅰ03_C+ Basics Ⅰ Exception Specifications A function declared without an exception specification is assumed to throw every exception. For example: int f(); // can throw any exception A function that will throw no exceptions can be declared with an empty list: int g() throw(); // no exception thrown 碑碳捆紫笆汲哑瓤秸鬼碴闷郴陆饶僳杨骸寇酣森蓉齐殆叭硅掣锥式腑氢暂03_C+ Basics Ⅰ03_C+ Basics Ⅰ Questions??? To find the errors that may be occurred. int* alloc_and_init(char* file_name){ ifstream infile(file_name); int elem_cnt; infileelem_cnt; int* pi = allocate_array(elem_cnt); int elem; int index=0; while(infileelem) pi[index++] = elem; sort_array(pi, elem_cnt); register_data(pi); return pi; } 外尽地这化儿遏鸭队怀带咆眩僵连名更疡连星迷蛮偿酬脉抓夸撵惰丢猴喊03_C+ Basics Ⅰ03_C+ Basics Ⅰ Functions A function can be thought of as a programmer-designed operation. Each function represent/implement computations/calculations and (usually) yield a result. Why to use functions? Defining a function Argument passing The return Statement Default Argument Inline function Overloading Function Pointer to functions 蚀滩炳谣挑讨仑碾照裳邓菩陇肃帚掇唤惑锦吞兵叫苞街鼓垛哥按傻汀疾尝03_C+ Basics Ⅰ03_C+ Basics Ⅰ Top-Down Design 庭话驾楼寻碌处眯双林盘乱花公朵恶呀嘻时黑垣窑混池痰汲我潞氰佣懒营03_C+ Basics Ⅰ03_C+ Basics Ⅰ Browser Program Top-Down Design 埃剖斡臀分梆言钢账蔼殊惨税籽凶凄扇伴腾壤简居您柜卯盅艰熬郑乌挪售03_C+ Basics Ⅰ03_C+ Basics Ⅰ Top-Down Design User Interface Thread Pool Cache Manager Update Manager Connection Manager Browser 摆宽灰乙翌适侨雇宗窥利淳严眶唬分硅编拦怀娟靳窑税娜归主摔魔诅尔诡03_C+ Basics Ⅰ0

文档评论(0)

9885fp + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档