ImageVerifierCode 换一换
格式:DOCX , 页数:9 ,大小:20.98KB ,
资源ID:8464356      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8464356.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C++关键字全.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C++关键字全.docx

1、C+关键字全(1)asmasm已经被_asm替代了,用于汇编语言嵌入在C/C+程序里编程,从而在某些方面优化代码。虽然用asm关键字编译时编译器不会报错,但是asm模块的代码是没有意义的。(2)auto 这个这个关键字用于声明变量的生存期为自动,即将不在任何类、结构、枚举、联合和函数中定义的变量视为全局变量,而在函数中定义的变量视为局部变量。这个关键字不怎么多写,因为所有的变量默认就是auto的。(3)bad_cast,const_cast,dynamic_cast,reinterpret_cast,static_cast关于异常处理的,还不是太了解.(4)bad_typeid也是用于异常处理

2、的,当typeid操作符的操作数typeid为Null指针时抛出.(5)bool不用多说了吧,声明布尔类型的变量或函数。(6)break跳出当前循环。The break statement terminates the execution of the nearest enclosing loop orconditional statement in which it appears。(7)caseswitch语句分支。Labels that appear after the case keyword cannot also appear outside aswitchstatement.(8

3、)catch,throw,try都是异常处理的语句,The try, throw, and catch statements implement exception handling。(9)char声明字符型变量或函数。(10)class声明或定义类或者类的对象。The class keyword declares a class type or defines an object of aclass type。(11)const被const修饰的东西都受到强制保护,可以预防意外的变动,能提高程序的健壮性。它可以修饰函数的参数、返回值,甚至函数的定义体。 作用: 1.修饰输入参数 a.对于非内

4、部数据类型的输入参数,应该将“值传递”的方式改为“const引用传递,目的是提高效率。例如将void Func(A a) 改为void Func(const A &a). b.对于内部数据类型的输入参数,不要将“值传递”的方式改为“const引用传递”。否则既达不到提高效率的目的,又降低了函数的可理解性.例如void Func(int x) 不应该改为void Func(const intx). 2.用const修饰函数的返回值 a.如果给以“指针传递”方式的函数返回值加const修饰,那么函数返回值(即指针)的内容不能被修改,该返回值只能被赋给加const修饰的同类型指针。 如对于:cons

5、t char * GetString(void); 如下语句将出现编译错误: char *str = GetString();/cannot convert from const char to char *; 正确的用法是: const char *str = GetString(); b。如果函数返回值采用“值传递方式”,由于函数会把返回值复制到外部临时的存储单元中,加const修饰没有任何价值。 如不要把函数int GetInt(void) 写成const int GetInt(void)。 3。const成员函数的声明中,const关键字只能放在函数声明的尾部,表示该类成员不修改对象.

6、 说明: const type m; /修饰m为不可改变 示例: typedef char pStr; /新的类型pStr; char string4 = abc; const char *p1 = string; p1+; /正确,上边修饰的是*p1,p1可变 const pStr p2 = string; p2+; /错误,上边修饰的是p2,p2不可变,p2可变 同理,const修饰指针时用此原则判断就不会混淆了。const int *value; /*value不可变,value可变 int* const value; /value不可变,value可变 const (int *) va

7、lue; /(int )是一种type,value不可变,value可变 /逻辑上这样理解,编译不能通过,需要tydef int NewType; const int const value;/value,value都不可变(12)continue结束当前循环,开始下一轮循环.Forces transfer of control to the controlling expression of thesmallest enclosing do, for, or while loop。(13)defaultswitch语句中的默认分支.None of the constants match th

8、e constants in the case labels;adefault label is present。Control is transferred to the default label.常量的无匹配情况下标签的常量;adefault标签present。Control转移到默认的标签。(14)delete经常用于动态内存分配的语句,Deallocates a block of memory。(15)do在do-while循环结构中开始循环体。Executes a statement repeatedly until the specifiedtermination conditi

9、on (the expression) evaluates to zero。(16)double声明双精度变量或函数.(17)else条件语句否定分支(与 if 连用).(18)enum声明枚举类型。The name of each enumerator is treated as a constant and must be unique withinthe scope where the enum is defined.(19)explicitThis keyword is a declaration specifier that can only be applied to inclas

10、s constructordeclarations。 An explicit constructor cannot take part in implicit conversions. It can onlybe used to explicitly construct an object。这个关键字声明说明符,可以只适用于同类构造函数声明。显式构造函数不能在隐式转换的一部分。它只能用于显式构造一个对象(20)exportMSDN只说The export keyword is not supported on templates。一种导出语句吧。.(21)externextern 意为“外来的

11、”它的作用在于告诉编译器:有这个变量,它可能不存在当前的文件中,但它肯定要存在于工程中的某一个源文件中或者一个Dll的输出中。声明变量是在其他文件中声明(也可以看做是引用变量)。Objects and variables declared as extern declare an object that is defined inanother translation unit or in an enclosing scope as having external linkage.(22)false,truebool类型的两个枚举值.(23)float声明浮点型变量或函数.(24)for一种循

12、环语句(可意会不可言传)。Use the for statement to construct loops that must execute aspecified number of times。(25)friend声明友元函数或者类。The friend keyword allows a function or class to gain access to theprivate and protected members of a class.(26)goto无条件跳转语句。Performs an unconditional transfer of control to the name

13、d label。(27)if条件语句.Controls conditional branching。常与else一起用.(28)inline声明定义内联函数,编译时将所调用的代码嵌入到主函数中.The inline specifiers instruct thecompiler to insert a copy of the function body into each place the function is called。(29)int声明整型变量或函数.(30)long声明长整型变量或函数。(31)mutableThis keyword can only be applied to

14、nonstatic and non-const data members of a class. If adata member is declared mutable, then it is legal to assign a value to this data member fromaconst member function。这个关键字只适用于非静态和非const数据类成员。如果一个声明数据成员是可变的,那么它是合法的赋值从这个数据成员aconst成员函数(32)namespaceDynamically imports an element behavior into a docume

15、nt.动态导入到文档中的元素行为c+中using namespace std(33)new动态内存分配。Allocates memory for an object or array of objects of typename from the freestore and returns a suitably typed, nonzero pointer to the object。分配内存的对象或数组类型的对象从自由的名义存储和返回一个适当类型,非零对象的指针(34)operatorThe operator keyword declares a function specifying wh

16、at operator-symbol means when appliedto instances of a class。 经营者关键字声明一个函数指定经营什么符号意味着当应用对一类的实例(35)private类私有函数和数据成员的标示.When preceding a list of class members, the private keywordspecifies that those members are accessible only from member functions and friends of theclass。 This applies to all member

17、s declared up to the next access specifier or the end ofthe class.当上一类的成员,私人关键字列表指定这些成员只能从成员的职能和朋友访问类.这适用于所有成员宣布了下一个访问符或结束类(36)protectedThe protected keyword specifies access to class members in the member-list up to the nextaccess specifier (public or private) or the end of the class definition。 受保

18、护的关键字指定访问类成员的成员名单,直至下一个访问说明符(公共或私营)或类定义结束(37)public访问方式:When preceding a list of class members, the public keyword specifies that thosemembers are accessible from any function。 This applies to all members declared up to thenext access specifier or the end of the class.当上一类成员,市民关键字列表指定的成员可以从任何功能。这适用于

19、所有成员宣布到明年访问符或类的结束(38)register 声明积存器变量。The register keyword specifies that the variable is to be stored in a machineregister, if possible。这个关键字命令编译器尽可能的将变量存在CPU内部寄存器中,而不是通过内存寻址访问,从而提高效率。 登记册关键字指定变量是要在计算机中存储的注册,如果可能的话(39)return子程序返回语句(可以带参数,也看不带参数),返回函数调用点。Terminates the execution of afunction and ret

20、urns control to the calling function (or, in the case of the main function,transfers control back to the operating system). Execution resumes in the calling functionat the point immediately following the call.终止执行的功能及控制返回给调用函数(或者,在主函数的情况,传输控制返回给操作系统).恢复执行在调用函数在点后立即致电(40)short声明短整型变量或函数。(41)signed,un

21、signed声明有符号类型变量或函数;声明无符号类型变量或函数。(42)static声明静态变量.When modifying a variable, the static keyword specifies that the variable hasstatic durationinitializes it to 0 unless another value is specified。当修改一个变量,static关键字指定的变量静态durationinitializes为0,除非另一个指定值(43)struct声明结构体变量或函数。struct 类型是一种值类型,通常用来封装小型相关变量组.

22、struct hello文件名(44)switchAllows selection among multiple sections of code, depending on the value of an integralexpression.允许选择多个之间的代码段,这取决于一个整体的价值表达(45)template模板.The template declaration specifies a set of parameterized classes or functions. 该模板声明指定的类或函数的参数化设置(46)thisThe this pointer is a pointer

23、accessible only within the nonstatic member functions of aclass,struct, or union type. 在该指针是一个指针访问只有在一个非静态成员函数类,结构或联合类型(47)typedef用以给数据类型取别名.Introduces a name that, within its scope, becomes a synonym for thetype given by the typedeclaration portion of the declaration.引入了一个名称,在其范围内,成为一个同义词该类型声明宣言的一部

24、分给定类型(48)typeidtypeid is used to get the Type for a type at compile time。typeid用于获取一个类型的类型在编译时(49)typenameTells the compiler that an unknown identifier is a type。Use this keyword only in templatedefinitions。告诉编译器是一个未知的标识符是一个type.Use这只是在模板中的关键字定义(50)union声明联合数据类型。A union is a userdefined data or clas

25、s type that, at any given time,contains only one object from its list of members (although that object can be an array or aclass type).阿联盟是一个用户定义的数据类型或类,在任何特定时间,只包含其成员名单的对象(虽然这个对象可以是一个数组或类类型)(51)usingThe using declaration introduces a name into the declarative region in which theusingdeclaration app

26、ears.使用声明的声明中引入了在该地区出现一个名称usingdeclaration(52)virtual声明虚基类或虚函数.The virtual keyword declares a virtual function or a virtual base class。virtual关键字声明了一个虚函数或虚基类(53)void声明函数无返回值或无参数,声明无类型指针。When used as a function return type, the void keyword specifies that the function does notreturn a value. When use

27、d for a functions parameter list, void specifies that the functiontakes no parameters。 When used in the declaration of a pointer, void specifies that thepointer is universal.”(54)volatile 说明变量在程序执行中可被隐含地改变,表明某个变量的值可能在外部被改变,优化器在用到这个变量时必须每次都小心地重新读取这个变量的值,而不是使用保存在寄存器里的备份。Thevolatile keyword isa type qualifier used to declare that an object can be modified in the program by somethingsuch as the operating system, the hardware, or a concurrently executing thread.Thevolatile关键字一个类型限定符用来声明一个对象可以在程序中修改的东西如操作系统,硬件或并发执行线程.(55)wchar_t宽字。(56)while循环语句的循环条件(57)class类

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1