![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
gaochang21
这个作者很懒,什么都没留下…
展开
-
c++ const引用与const指针
本文主要以代码形式阐述C++中const的用法以及const与引用、指针之间的关系。#include "stdafx.h" #include <iostream>using namespace std;void fun(const int &const ref) { cout << ref << endl; }void fun(const int *const point) { co原创 2017-08-04 15:38:14 · 368 阅读 · 0 评论 -
string对象小结
string对象小结#include <iostream> #include <string> using namespace std;int main() { string str1 = "hello"; //赋值初始化,不包括字面值常量最后的空字符 string str2 = "hello "; string str3("hello"); //直接初原创 2017-09-07 23:00:54 · 223 阅读 · 0 评论 -
初始化总结
初始化定义:初始化不是赋值,初始化是指创建一个变量时赋予其一个初始值,赋值的含义是把对象当前值擦除,以一个新值代替。 拷贝初始化:使用等号“=”赋值的初始化为拷贝初始化 直接初始化:不使用等号“=”赋值的初始化为直接初始化 当初始值只有一个时,拷贝初始化与直接初始化均可用,当初始值有多个时最好使用直接初始化。 列表初始化:使用花括号“{}”来进行初始化,初始化的是每个元素的值。与之相反,使用圆括号是原创 2017-09-08 10:08:37 · 465 阅读 · 0 评论