{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/cpp-keyword-notes/",
  "atlas": "https://www.pystone.net/?node=cpp-keyword-notes#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/cpp-keyword-notes.md",
  "context": "https://www.pystone.net/notes/cpp-keyword-notes.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:cpp-keyword-notes",
  "slug": "cpp-keyword-notes",
  "title": "C++一些关键字的知识点",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "C++一些关键字的知识点",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "492f5b4e0ab7101763a6fd82ad79c93b2c2f77ad97276eb1a11980b4772a8d9f",
  "assets": [],
  "headings": [
    {
      "depth": 1,
      "text": "C++一些关键字的知识点",
      "anchor": "c一些关键字的知识点",
      "citation": "https://www.pystone.net/notes/cpp-keyword-notes/#c%E4%B8%80%E4%BA%9B%E5%85%B3%E9%94%AE%E5%AD%97%E7%9A%84%E7%9F%A5%E8%AF%86%E7%82%B9"
    },
    {
      "depth": 3,
      "text": "const",
      "anchor": "const",
      "citation": "https://www.pystone.net/notes/cpp-keyword-notes/#const"
    },
    {
      "depth": 3,
      "text": "static",
      "anchor": "static",
      "citation": "https://www.pystone.net/notes/cpp-keyword-notes/#static"
    },
    {
      "depth": 3,
      "text": "this指针",
      "anchor": "this指针",
      "citation": "https://www.pystone.net/notes/cpp-keyword-notes/#this%E6%8C%87%E9%92%88"
    },
    {
      "depth": 3,
      "text": "inline 内联函数",
      "anchor": "inline-内联函数",
      "citation": "https://www.pystone.net/notes/cpp-keyword-notes/#inline-%E5%86%85%E8%81%94%E5%87%BD%E6%95%B0"
    },
    {
      "depth": 3,
      "text": "默认构造函数",
      "anchor": "默认构造函数",
      "citation": "https://www.pystone.net/notes/cpp-keyword-notes/#%E9%BB%98%E8%AE%A4%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0"
    }
  ],
  "claims": [],
  "outgoing": [],
  "incoming": [
    {
      "id": "note:programming-languages-and-runtimes",
      "title": "编程语言与运行时",
      "url": "https://www.pystone.net/notes/programming-languages-and-runtimes/",
      "atlas": "https://www.pystone.net/?node=programming-languages-and-runtimes#knowledge-atlas",
      "label": "编程语言与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "C++中的“C++一些关键字的知识点”导航项",
      "citation": "https://www.pystone.net/notes/programming-languages-and-runtimes/#c"
    }
  ],
  "contentMarkdown": "# C++一些关键字的知识点\n\n﻿# C++一些关键字的知识点\n\n> 创建时间：2020/1/10 16:32\n\n### const\n\n```cpp\nstring str1 = &quot;test&quot;;\nstring str2 = &quot;test&quot;;\n\n```\n\n### static\n\n作用\n\n  1. 修饰普通变量，修改变量的存储区域和生命周期，使变量存储在静态区，在 main 函数运行前就分配了空间，如果有初始值就用初始值初始化它，如果没有初始值系统用默认值初始化它。\n  2. 修饰普通函数，表明函数的作用范围，仅在定义该函数的文件内才能使用。在多人开发项目时，为了防止与他人命名空间里的函数重名，可以将函数定位为 static。\n  3. 修饰成员变量，修饰成员变量使所有的对象只保存一个该变量，而且不需要生成对象就可以访问该成员。\n  4. 修饰成员函数，修饰成员函数使得不需要生成对象就可以访问该函数，但是在 static 函数内不能访问非静态成员。\n\n### this指针\n\n一个隐含于每一个非静态成员函数中的特殊指针。\n指向这个成员函数所在的对象的指针。\nthis 指针被隐含地声明为: const ClassName* const this。\n\n是个右值，不能修改，不能取地址。\n\n### inline 内联函数\n\n相当于不用执行进入函数的步骤，直接执行函数体；相当于宏，却比宏多了类型检查，真正具有函数特性；编译器一般不内联包含循环、递归、switch 等复杂操作的内联函数；在类声明中定义的函数，除了虚函数的其他函数都会自动隐式地当成内联函数。\n\n### 默认构造函数\n\n用户自定义了任意一个构造函数，那么编译器就不会提供默认的构造函数\n"
}
