C++学习笔记

来源:互联网 发布:手机淘宝会员名是什么 编辑:程序博客网 时间:2024/05/24 06:50

1.因为常量在定义后就不能被修改,所以定义时必须初始化:

const std::string hi = "hello!"; // ok: initialized

const int i, j = 0;  // error: i is uninitialized const


2.typedef让我们可以定义类型的同义词:

typedef double wages;       //  wages is a synonym for double

typedef int exam_score;     //  exam_score is a synonym for int

typedef wages salary;       //  indirect synonym for double

原创粉丝点击