c++基本知识,更新

整理网上的基本常见知识点。

1

对于C++中的类,结构体,共用体等具有成员函数或变量的数据类型(对象)时,如果存在对象a,而对象中有成员b,那么可以使用a.b的方式,使用对应的成员。
如果存在变量p,指向a, 即p = &a, 这时可以用p->b来使用成员b。
即,->操作符是用于带成员的类型对应指针上,用来提取成员变量或函数用的。
p->b等同于(*p).b。
对于任意的对象a,写作(&a)->b也是可以的,不过很少有这样写。

2

::的作用

  • A::member就表示类A中的成员member  作用域符号
  • 局作用域符号:当全局变量在局部函数中与其中某个变量重名,那么就可以用::来区分如:

char    var;    //全局变量

void    sleep()

      char    var;    //局部变量

      var(局部变量) = var(局部变量) *var(局部变量) ; 

     ::var(全局变量) =::var(全局变量) *char(局部变量);

3

include <> 到标准函数库中寻找文件

include “”  从当前目录寻找文件

4

gcc    g++ 编译原理

       When you invoke GCC, it normally does preprocessing, compilation,
       assembly and linking.  The "overall options" allow you to stop this
       process at an intermediate stage.  For example, the -c option says not
       to run the linker.  Then the output consists of object files output by
       the assembler.

       Other options are passed on to one or more stages of processing.  Some
       options control the preprocessor and others the compiler itself.  Yet
       other options control the assembler and linker; most of these are not
       documented here, since you rarely need to use any of them.


       Most of the command-line options that you can use with GCC are useful
       for C programs; when an option is only useful with another language
       (usually C++), the explanation says so explicitly.  If the description
       for a particular option does not mention a source language, you can use
       that option with all supported languages.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值