TCPL_4 types and declarations
来源:互联网 发布:淘宝搜索屏蔽关键词 编辑:程序博客网 时间:2024/04/30 10:10
4.1 types
consider x=y+f(2); For this to make sense in a c++ program, the names x, y, and f must be suitably declared. That is, the programmer must specify that entities named x, y, and f exit and that they are of types for which =(assignment), +(addition), and()(function call), respectively, are meaningful.
c++程序中出现的名字在使用之前必须被合理的声明,就是说,程序员必须指定实体x, y, f,是存在的,并且这三个实体的类型具有这样的特点,当赋值操作,加操作,函数调用操作作用在这些类型的对象上时,这些操作是有意义的。
Every name(identifier) in a c++ program has a type associated with it. This type determines what operations can be applied to the name(that is, to the entity referred to by the name) and how such operations are interpreted.
float x; // x is a floating-point variable
int y; // y is an integer variable with the initial value 7
float f(int); // f is a function taking an argument of type int and returning a floating-point number
would make the example meaningful.(将能使x=y+f(2);有意义),顺便说一下,我觉得赋值操作符,加操作符,实际上都是函数,针对于自定义类型时,我们重载操作符,不也是把这些操作符来当作函数来处理的么,扩展一上,最好不要把操作符与变量之间加上空格,那样好像是把函数与参数分开了定一样不好。
4.1.1 fundamental types
c++ has a set of fundamental types corresponding to the most
- TCPL_4 types and declarations
- 第六章: types and declarations
- SCJP01:declarations and access controls
- EC之Designs and Declarations
- Statements and Declarations in Expressions
- Conclusion for Designs and Declarations
- Reference Types and Values Types
- Generic types and Wildcard types
- declarations
- ISO C90 forbids mixed declarations and code
- Effect C++ 笔记 【4 Designs and Declarations】
- ISO C89 forbids mixed declarations and code
- C++ Chapter 4. Designs and Declarations
- Definitions and Declarations (C++) dllimport dllexport
- ISO C89 forbids mixed declarations and code
- ISO C90 forbids mixed declarations and code
- effective C++学习(Designs and Declarations)
- Primitive Types and Objects
- Delphi ADOStoredProc 存储过程用法
- 供应链
- 经典笑话:女朋友生气时的场景
- Star Trek
- GeoWorld: KML and GML Working Together
- TCPL_4 types and declarations
- 强力推荐一个Makefile教程
- 探究 Flex 组件的生命周期
- WCF之Binding
- apache2+php+mysql+svn+mantis安装配置包,绿色,解压即可运行不用安装
- 路漫漫
- 写日记,是一个好习惯!
- [转] 2011年开春大戏──CES看点啥?
- 建一个更安全、更让人放心的网际网络(一)