C++简介源码讲解精辟版,C++入门级C++学习,C++与C的区别值得知晓

C++简介源码讲解精辟版,C++入门级C++学习,C++与C的区别值得知晓

0?wx_fmt=jpeg

C语言和C++基础区别

0?wx_fmt=jpeg

C++标准输入和输出

0?wx_fmt=jpeg

命名空

1.命名空间的定义 

namespace 标识符{ } 例:namespace my{int a=1;}

命名空间中的成员访问:作用域分辨符:: 例: cout<<my::a<<endl;

省略限定符(前缀):using namespace my;

联想到 标准命名空间 :using namespace std; 标准命名空间 没有这个,需要加std::cout ,std::cin ,std::endl;

2 .命名空间的嵌套

cout<<my::danny::b<<endl;不想使用这么长的前缀

1:using namespace my::danny;

2: namespace IM=my::danny

0?wx_fmt=jpeg

bool:布尔类型

1. 值:0 和1 或者false和true

2. 代表是真和假,计算机里面非零表示真,只有0表示假

3. 内存占用 1个字节

一般当做判断函数的返回值类型使用

0?wx_fmt=jpeg

引用类型

1.起别名的作用

2.防止拷贝本产生

3.当作左值使用

4.右值引用:常量的引用 例:int A(int && mm); 调用时候可以使用A(1);

0?wx_fmt=jpeg

堆内存申请

由原来的malloc,realloc,calloc,free 等改为new和delete

0?wx_fmt=jpeg

结构体:

1.定义变量直接使用结构体名,可以省略关键字struct

2.结构体中允许成员的存在,以及构造函数的存在

0?wx_fmt=jpeg

inline 内联

inline关键字用来定义一个类的内联函数,引入它的主要原因是用它替代C中表达式形式的宏定义。

0?wx_fmt=jpeg

函数重载

函数重载:允许函数名相同,参数不同的函数存在

1.参数数目不同

2.参数类型不同

3.参数类型不同时候参数类型不同

0?wx_fmt=jpeg

函数缺省

函数缺省:允许函数参数被初始化

1.函数缺省其实是重载的一种优化体

2.函数缺省必须从右往左缺省

0?wx_fmt=jpeg

0?wx_fmt=jpeg

0?wx_fmt=gif 0?wx_fmt=gif 0?wx_fmt=jpeg



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
神书-STL实现原理,对于强化数据结构-算法的程序员必备、必读书籍。The Best-Selling Programmer Resource–Now Updated for C++11 The C++ standard library provides a set of common classes and interfaces that greatly extend the core C++ language. The library, however, is not self-explanatory. To make full use of its components - and to benefit from their power - you need a resource that does far more than list the classes and their functions. The C++ Standard Library - A Tutorial and Reference, 2nd Edition describes this library as now incorporated into the new ANSI/ISO C++ language standard (C++11). The book provides comprehensive documentation of each library component, including an introduction to its purpose and design; clearly written explanations of complex concepts; the practical programming details needed for effective use; traps and pitfalls; the exact signature and definition of the most important classes and functions; and numerous examples of working code. The book focuses on the Standard Template Library (STL), examining containers, iterators, function objects, and STL algorithms. You will also find detailed coverage of strings, concurrency, random numbers and distributions, special containers, numerical classes, internationalization, and the IOStreams library. An insightful introduction to fundamental concepts and an overview of the library will help bring newcomers quickly up to speed. A comprehensive index will support the C++ programmer in his/her day-to-day life.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值