比NotePad++更好的文本代码(C#)编辑器Sublime Text

摘要:
配置并调用C#编译器。我现在的计算机系统是Win7。我想将C#编译器的csc.exe文件添加到环境变量中。“,”selector“:”source.cs“,”encoding“:”cp936“}将其保存为ST2程序目录的package/User文件夹,文件名为:C#.sublime build。配置三个函数以使代码运行非常简单。它是在我的计算机上的C#编译器路径中创建RunCSharp.bat文件,即C:Windows Microsoft.NET Framework v4.0.30319,然后在其中写入以下内容:@ECHOOFFcd%~dp1ECHOCompiling%~nx1……IFEXIST%~n1。execsc%~nx1IFEXIST%~n1.exe,当然,只添加添加上述文件是不够的。您还需要修改C#。崇高的构建刚刚添加到编译器中。修改后的内容如下:{“cmd”:[“RunCSharp.bat”,“$file”],“file_regex”:“^(…*?DOCTYPeplistPUBLIC”-//Apple//DTDPLIST1.0//EN”http://www.apple.com/DTDs/PropertyList-1.0.dtd“˃nameCommentsscopesource.cssettingsshellVariablesnameTM_COMMENT_START˃value//1name<string˃TM_COMMENT _START_2value/”*nameTM_COMMENT_END_2值*/uuidFBA964F9-2013-44D1-A5FD-AE8AB3F8954添加注释文件后,可以向C#代码添加注释。

前言

 前两天在博客园看到@晴天猪的博客发表的关于他使用的代码编辑器,自己索性试了一下,果断好用,自己也来记录一下。以便以后配置使用。接下来我配置的主要是简单的编译C#代码的。

配置一调用C#编译器

 我现在电脑的系统为Win7哦。我要将C#编译器的csc.exe文件添加到环境变量中。

首先我的电脑==右键属性==高级系统设置==环境变量==系统变量==变量Path双击==在变量值中将路径添加到后面添加前用;分隔C:\Windows\Microsoft.NET\Framework\v4.0.30319

配置二新建编译器选项

 打开Submile Text

比NotePad++更好的文本代码(C#)编辑器Sublime Text第1张

 工具  编译系统   最下面的编译新系统,然后将如下命令斤西瓜复制

{
      "cmd": ["csc", "$file"],
      "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
      "selector": "source.cs",
      "encoding": "cp936"
 }

另存为ST2程序目录的Packages/User文件夹下面,文件名为:C#.sublime-build。

比NotePad++更好的文本代码(C#)编辑器Sublime Text第2张

测试编译代码

 下面在ST中编写一些简单的代码如下

using System;
using System.Linq;
class  Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Hello World");
        Console.ReadLine();
    }
}

将代码随便保存为一个文件后缀为cs哦。然后Ctrl+B就OK了。

比NotePad++更好的文本代码(C#)编辑器Sublime Text第3张

现在只能编译,但是不能测试运行。你我们接下来配置一下吧。

配置三能让代码运行起来

 其实很简单,就是在C#编译器路径中我的电脑也就是C:\Windows\Microsoft.NET\Framework\v4.0.30319中创建RunCSharp.bat文件,然后在其中写入以下内容:

@ECHO OFF
 cd %~dp1
 ECHO Compiling %~nx1.......
 IF EXIST %~n1.exe (
 DEL %~n1.exe
 )
 csc %~nx1
 IF EXIST %~n1.exe (
 ECHO -----------OUTPUT-----------
 start %~n1
 )

当然光添加上述文件还不够,还需要修改刚刚在编译器中添加的C#.sublime-build,修改后内容如下:

{
      "cmd": ["RunCSharp.bat", "$file"],
      "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
      "selector": "source.cs",
      "encoding": "cp936"
 }

下面再Ctrl+B一下刚刚写的简单的代码吧

比NotePad++更好的文本代码(C#)编辑器Sublime Text第4张

配置四可以给代码添加注释

 C#中的注释快捷键是无效的,这是因为Packages文件夹中缺少了定义注释行为的文件。打开Packages,在C#文件夹中添加一个名为:Comments.tmPreferences文件,输入如下内容:

比NotePad++更好的文本代码(C#)编辑器Sublime Text第5张比NotePad++更好的文本代码(C#)编辑器Sublime Text第6张View Code
View Code 
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
     <key>name</key>
     <string>Comments</string>
     <key>scope</key>
     <string>source.cs</string>
     <key>settings</key>
     <dict>
         <key>shellVariables</key>
         <array>
             <dict>
                 <key>name</key>
                 <string>TM_COMMENT_START</string>
                 <key>value</key>
                 <string>// </string>
             </dict>
             <dict>
                 <key>name</key>
                 <string>TM_COMMENT_START_2</string>
                 <key>value</key>
                 <string>/*</string>
             </dict>
             <dict>
                 <key>name</key>
                 <string>TM_COMMENT_END_2</string>
                 <key>value</key>
                 <string>*/</string>
             </dict>
         </array>
     </dict>
     <key>uuid</key>
     <string>FBA964F9-2013-44D1-A5FD-AE8AB3FF8954</string>
 </dict>
 </plist>

添加注释文件后,就可以为C#代码添加注释了。

配置五可以添加关键字高亮

 编程语言的关键字在ST2中是高亮显示的,对于ST2我们需要自己定义一下关键字,例如:virtual,var等,这时我们需要修改Packages文件夹中的C#文件夹的C#.tmLanguage文件,修改后文件的内容如下:

比NotePad++更好的文本代码(C#)编辑器Sublime Text第7张比NotePad++更好的文本代码(C#)编辑器Sublime Text第8张View Code
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
     <key>fileTypes</key>
     <array>
         <string>cs</string>
     </array>
     <key>foldingStartMarker</key>
     <string>^\s*/\*|^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S))</string>
     <key>foldingStopMarker</key>
     <string>^\s*\*/|^\s*\}</string>
     <key>keyEquivalent</key>
     <string>^~C</string>
     <key>name</key>
     <string>C#</string>
     <key>patterns</key>
     <array>
         <dict>
             <key>begin</key>
             <string>///</string>
             <key>captures</key>
             <dict>
                 <key>0</key>
                 <dict>
                     <key>name</key>
                     <string>punctuation.definition.comment.source.cs</string>
                 </dict>
             </dict>
             <key>end</key>
             <string>$\n?</string>
             <key>name</key>
             <string>comment.block.documentation.source.cs</string>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>begin</key>
                     <string>(&lt;/?)(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]+)</string>
                     <key>captures</key>
                     <dict>
                         <key>1</key>
                         <dict>
                             <key>name</key>
                             <string>punctuation.definition.tag.source.cs</string>
                         </dict>
                         <key>2</key>
                         <dict>
                             <key>name</key>
                             <string>entity.name.tag.namespace.source.cs</string>
                         </dict>
                         <key>3</key>
                         <dict>
                             <key>name</key>
                             <string>entity.name.tag.source.cs</string>
                         </dict>
                         <key>4</key>
                         <dict>
                             <key>name</key>
                             <string>punctuation.separator.namespace.source.cs</string>
                         </dict>
                         <key>5</key>
                         <dict>
                             <key>name</key>
                             <string>entity.name.tag.localname.source.cs</string>
                         </dict>
                     </dict>
                     <key>end</key>
                     <string>(/?&gt;)</string>
                     <key>name</key>
                     <string>keyword.other.documentation.source.cs</string>
                     <key>patterns</key>
                     <array>
                         <dict>
                             <key>captures</key>
                             <dict>
                                 <key>1</key>
                                 <dict>
                                     <key>name</key>
                                     <string>entity.other.attribute-name.namespace.source.cs</string>
                                 </dict>
                                 <key>2</key>
                                 <dict>
                                     <key>name</key>
                                     <string>entity.other.attribute-name.source.cs</string>
                                 </dict>
                                 <key>3</key>
                                 <dict>
                                     <key>name</key>
                                     <string>punctuation.separator.namespace.source.cs</string>
                                 </dict>
                                 <key>4</key>
                                 <dict>
                                     <key>name</key>
                                     <string>entity.other.attribute-name.localname.source.cs</string>
                                 </dict>
                             </dict>
                             <key>match</key>
                             <string> (?:([-_a-zA-Z0-9]+)((:)))?([_a-zA-Z-]+)=</string>
                         </dict>
                         <dict>
                             <key>include</key>
                             <string>#doubleQuotedString</string>
                         </dict>
                         <dict>
                             <key>include</key>
                             <string>#singleQuotedString</string>
                         </dict>
                     </array>
                 </dict>
             </array>
         </dict>
         <dict>
             <key>include</key>
             <string>#comments</string>
         </dict>
         <dict>
             <key>begin</key>
             <string>(?x)^\s*
 ((?:\b(?:new|public|protected|internal|private|abstract|sealed|static)\b\s)*)
 (class)\s+
 ([A-Za-z_]\w+)\b</string>
             <key>captures</key>
             <dict>
                 <key>1</key>
                 <dict>
                     <key>name</key>
                     <string>storage.modifier.source.cs</string>
                 </dict>
                 <key>2</key>
                 <dict>
                     <key>name</key>
                     <string>storage.type.source.cs</string>
                 </dict>
                 <key>3</key>
                 <dict>
                     <key>name</key>
                     <string>entity.name.type.class.source.cs</string>
                 </dict>
             </dict>
             <key>end</key>
             <string>{</string>
             <key>name</key>
             <string>meta.definition.class.source.cs</string>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>include</key>
                     <string>#classInheritance</string>
                 </dict>
             </array>
         </dict>
         <!--
         Disabled because it causes some lines to be interpreted incorrectly, for example:
             else if (c == ')')
         --->
         <!--
         <dict>
             <key>begin</key>
             <string>(?x)^\s*                                                                                # start of line
 ((?:\b(?:new|public|protected|internal|private|static|virtual|sealed|override|abstract|extern)\b\s*)*)         # method-modifiers
 \b((?:\w+\.)*[A-Za-z_]\w*)\b\s*                                                                                  # type
 (operator)\s+                                                                                                  # operator overload
 ((?:\+|-|!|~|\+\+|--|true|false|\*|/|%|\&amp;|\||\^|&lt;&lt;|&gt;&gt;|==|!=|&lt;|&gt;|&lt;=|&gt;=)\s*)                                      # operator name
 (?=\()</string>
             <key>captures</key>
             <dict>
                 <key>1</key>
                 <dict>
                     <key>name</key>
                     <string>storage.modifier.source.cs</string>
                 </dict>
                 <key>2</key>
                 <dict>
                     <key>name</key>
                     <string>storage.type.source.cs</string>
                 </dict>
                 <key>3</key>
                 <dict>
                     <key>name</key>
                     <string>storage.modifier.source.cs</string>
                 </dict>
                 <key>4</key>
                 <dict>
                     <key>name</key>
                     <string>entity.name.function.source.cs</string>
                 </dict>
             </dict>
             <key>end</key>
             <string>\)</string>
             <key>name</key>
             <string>meta.definition.operator.source.cs</string>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>include</key>
                     <string>#statementRemainder</string>
                 </dict>
             </array>
         </dict>
         <dict>
             <key>begin</key>
             <string>(?x)^\s*                                                                            # start of line
 ((?:\b(?:new|public|protected|internal|private|static|virtual|sealed|override|abstract|extern)\b\s*)*)     # method-modifiers
 \b((?:\w+\.)*[A-Za-z_]\w*)\b\s*                                                                              # type
 ([A-Za-z_]\w*)\s*                                                                                             # name
 (?=\()</string>
             <key>captures</key>
             <dict>
                 <key>1</key>
                 <dict>
                     <key>name</key>
                     <string>storage.modifier.source.cs</string>
                 </dict>
                 <key>2</key>
                 <dict>
                     <key>name</key>
                     <string>storage.type.source.cs</string>
                 </dict>
                 <key>3</key>
                 <dict>
                     <key>name</key>
                     <string>entity.name.function.source.cs</string>
                 </dict>
             </dict>
             <key>end</key>
             <string>\)</string>
             <key>name</key>
             <string>meta.definition.method.source.cs</string>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>include</key>
                     <string>#statementRemainder</string>
                 </dict>
             </array>
         </dict>
         -->
         <dict>
             <key>match</key>
             <string>\b(true|false|null|this|base)\b</string>
             <key>name</key>
             <string>constant.language.source.cs</string>
         </dict>
         <dict>
             <key>match</key>
             <string>\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b</string>
             <key>name</key>
             <string>constant.numeric.source.cs</string>
         </dict>
         <dict>
             <key>match</key>
             <string>\b(if|else|while|for|foreach|do|return|continue|break|switch|case|default|goto|throw|try|catch|finally|lock|yield)\b</string>
             <key>name</key>
             <string>keyword.control.source.cs</string>
         </dict>
         <dict>
             <key>match</key>
             <string>\b(new|is|checked|unchecked|typeof|sizeof|override|in|out|ref|readonly|params|stackalloc|as)\b</string>
             <key>name</key>
             <string>keyword.operator.source.cs</string>
         </dict>
         <dict>
             <key>match</key>
             <string>\b(event|delegate|explicit|implicit|in|set|get)\b</string>
             <key>name</key>
             <string>keyword.other.source.cs</string>
         </dict>
         <dict>
             <key>match</key>
             <string>\b(internal|public|protected|private|static|const|new|sealed|abstract|virtual|override|extern|unsafe|readonly|volatile|operator)\b</string>
             <key>name</key>
             <string>storage.modifier.source.cs</string>
         </dict>
         <dict>
             <key>include</key>
             <string>#doubleQuotedStringLiteral</string>
         </dict>
         <dict>
             <key>include</key>
             <string>#doubleQuotedString</string>
         </dict>
         <dict>
             <key>include</key>
             <string>#singleQuotedString</string>
         </dict>
         <dict>
             <key>captures</key>
             <dict>
                 <key>1</key>
                 <dict>
                     <key>name</key>
                     <string>keyword.other.using.source.cs</string>
                 </dict>
                 <key>2</key>
                 <dict>
                     <key>name</key>
                     <string>entity.name.type.package.source.cs</string>
                 </dict>
             </dict>
             <key>match</key>
             <string>^\s*(using)\s+([^ ;]*);</string>
             <key>name</key>
             <string>meta.keyword.using.source.cs</string>
         </dict>
         <dict>
             <key>include</key>
             <string>#builtinTypes</string>
         </dict>
         <dict>
             <key>captures</key>
             <dict>
                 <key>1</key>
                 <dict>
                     <key>name</key>
                     <string>keyword.other.namespace.source.cs</string>
                 </dict>
                 <key>2</key>
                 <dict>
                     <key>name</key>
                     <string>entity.name.type.namespace.source.cs</string>
                 </dict>
             </dict>
             <key>match</key>
             <string>^\s*(namespace)\s+([^ ]+)(?:\s*{)?$</string>
             <key>name</key>
             <string>meta.keyword.namespace.source.cs</string>
         </dict>
         <dict>
             <key>captures</key>
             <dict>
                 <key>2</key>
                 <dict>
                     <key>name</key>
                     <string>keyword.control.import.source.cs</string>
                 </dict>
             </dict>
             <key>match</key>
             <string>^(#)\s*(if|else|elif|endif|define|undef|warning|error|line|region|endregion)\b</string>
             <key>name</key>
             <string>meta.preprocessor.source.cs</string>
         </dict>
     </array>
     <key>repository</key>
     <dict>
         <key>builtinTypes</key>
         <dict>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>match</key>
                     <string>\b(bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|class|struct|enum|interface|var|from|where|select|group|into|orderby|join|let|ascending|descending|on|by)\b</string>
                     <key>name</key>
                     <string>storage.type.source.cs</string>
                 </dict>
             </array>
         </dict>
         <key>classInheritance</key>
         <dict>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>begin</key>
                     <string>:</string>
                     <key>end</key>
                     <string>(?={)</string>
                     <key>patterns</key>
                     <array>
                         <dict>
                             <key>captures</key>
                             <dict>
                                 <key>1</key>
                                 <dict>
                                     <key>name</key>
                                     <string>storage.type.source.cs</string>
                                 </dict>
                             </dict>
                             <key>match</key>
                             <string>\s*,?([A-Za-z_]\w*)\b</string>
                         </dict>
                     </array>
                 </dict>
             </array>
         </dict>
         <key>comments</key>
         <dict>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>begin</key>
                     <string>/\*</string>
                     <key>captures</key>
                     <dict>
                         <key>0</key>
                         <dict>
                             <key>name</key>
                             <string>punctuation.definition.comment.source.cs</string>
                         </dict>
                     </dict>
                     <key>end</key>
                     <string>\*/\n?</string>
                     <key>name</key>
                     <string>comment.block.source.cs</string>
                 </dict>
                 <dict>
                     <key>captures</key>
                     <dict>
                         <key>1</key>
                         <dict>
                             <key>name</key>
                             <string>punctuation.definition.comment.source.cs</string>
                         </dict>
                     </dict>
                     <key>match</key>
                     <string>(//).*$\n?</string>
                     <key>name</key>
                     <string>comment.line.double-slash.source.cs</string>
                 </dict>
             </array>
         </dict>
         <key>doubleQuotedString</key>
         <dict>
             <key>begin</key>
             <string>"</string>
             <key>beginCaptures</key>
             <dict>
                 <key>0</key>
                 <dict>
                     <key>name</key>
                     <string>punctuation.definition.string.begin.source.cs</string>
                 </dict>
             </dict>
             <key>end</key>
             <string>"</string>
             <key>endCaptures</key>
             <dict>
                 <key>0</key>
                 <dict>
                     <key>name</key>
                     <string>punctuation.definition.string.end.source.cs</string>
                 </dict>
             </dict>
             <key>name</key>
             <string>string.quoted.double.source.cs</string>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>match</key>
                     <string>\\.</string>
                     <key>name</key>
                     <string>constant.character.escape.source.cs</string>
                 </dict>
             </array>
         </dict>
         <key>doubleQuotedStringLiteral</key>
         <dict>
             <key>captures</key>
             <dict>
                 <key>0</key>
                 <dict>
                     <key>name</key>
                     <string>punctuation.definition.string.begin.source.cs</string>
                 </dict>
             </dict>
             <key>match</key>
             <string>@"([^"]|"")*"</string>
             <key>name</key>
             <string>string.quoted.double.literal.source.cs</string>
         </dict>
         <key>singleQuotedString</key>
         <dict>
             <key>begin</key>
             <string>'</string>
             <key>beginCaptures</key>
             <dict>
                 <key>0</key>
                 <dict>
                     <key>name</key>
                     <string>punctuation.definition.string.begin.source.cs</string>
                 </dict>
             </dict>
             <key>end</key>
             <string>'</string>
             <key>endCaptures</key>
             <dict>
                 <key>0</key>
                 <dict>
                     <key>name</key>
                     <string>punctuation.definition.string.end.source.cs</string>
                 </dict>
             </dict>
             <key>name</key>
             <string>string.quoted.single.xml</string>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>match</key>
                     <string>\\.</string>
                     <key>name</key>
                     <string>constant.character.escape.source.cs</string>
                 </dict>
             </array>
         </dict>
         <key>statementRemainder</key>
         <dict>
             <key>patterns</key>
             <array>
                 <dict>
                     <key>begin</key>
                     <string>\(</string>
                     <key>end</key>
                     <string>(?=\))</string>
                     <key>name</key>
                     <string>meta.definition.param-list.source.cs</string>
                     <key>patterns</key>
                     <array>
                         <dict>
                             <key>include</key>
                             <string>#builtinTypes</string>
                         </dict>
                     </array>
                 </dict>
             </array>
         </dict>
     </dict>
     <key>scopeName</key>
     <string>source.cs</string>
     <key>uuid</key>
     <string>1BA75B32-707C-11D9-A928-000D93589AF6</string>
 </dict>
 </plist>

配置六可以添加代码片段

 对于一些常用的代码片段,我们不需要每次都手动输入一遍,可以将它们配置问代码片段,减少手动代码输入量,效果类似于Visual Studio的智能提示,如下:
 
例如输入fore时,会出现foreach的提示:

比NotePad++更好的文本代码(C#)编辑器Sublime Text第9张然后Enter后就可以看到

    static void Main(string[] args)
    {
        Console.WriteLine("Hello World");
        foreach (var item in )
        {
            
        }
        Console.ReadLine();
    }

总结

 对了,还可以修改字体大小哦

比NotePad++更好的文本代码(C#)编辑器Sublime Text第10张比NotePad++更好的文本代码(C#)编辑器Sublime Text第11张

感觉很好用哦。

配置文件下载:C#.zip (将所有文件复制Packages文件夹下的C#文件夹即可,配置文件包括常用的代码片段,注释配置,和关键字的定义。)

这是我现在使用的Submile Text所有文件,下载解压http://url.cn/UXdqo4。然后设置环境变量,并设置一下配置三就可以了,当然有很多功能还有待自己摸索和开发哦

参考博客http://www.cnblogs.com/IPrograming/archive/2013/05/02/ST2_CSharpConfig.html

免责声明:文章转载自《比NotePad++更好的文本代码(C#)编辑器Sublime Text》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇antd-select选项位置偏移问题解决c++从文件中读取一行数据并保存在数组中下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Xcode 编辑器之Workspace,Project,Scheme,Target

一,前言 最近老是突然对Workspace,Project,Scheme,Target四者的关系有些疑惑,所以查阅资料总结一下。 二,Workspace,Project,Scheme,Target四者的定义1. Xcode Workspace(可类比为“办公大楼”)定义:Workspace是组织projects和其他协同工作的一份文档。作用:1. 它将一些...

ElasticSearch索引与搜索

在系列的第一篇文章中我们介绍了ElasticSearch的基本概念和操作,本文将继续介绍ElasticSearch查询和索引功能。 目录: 查询 精确查询 term查询 terms查询 range查询 全文查询 match查询 multi_match查询 script查询 组合查询 bool查询 dis_max查询 function_sc...

asp.net中序列化和反序列化json的两种常用方式

使用System.Web.Script.Serialization.JavaScriptSerializer类       JavaScriptSerializer类为.net类库自带,.net3.5及以后版本都可以使用,该类位于System.Web.Extensions.dll中,如需使用该类,必须添加引用。      (1) 序列化 p...

Android中Parcel的分析以及使用

简单点来说:Parcel就是一个存放读取数据的容器, Android系统中的binder进程间通信(IPC)就使用了Parcel类来进行客户端与服务端数据的交互,而且AIDL的数据也是通过Parcel来交互的。在Java空间和C++都实现了Parcel,由于它在C/C++中,直接使用了内存来读取数据,因此,它更有效率。 分析Binder机制中的客户端与服务...

RocketMQ(一)原理和实战!

一、RocketMQ的安装 1、文档 官方网站 http://rocketmq.apache.org GitHub https://github.com/apache/rocketmq 2、下载 wget https://mirror.bit.edu.cn/apache/rocketmq/4.7.0/rocketmq-all-4.7.0-bin-relea...

C++11 之 override

override 关键字 作用:在成员函数声明或定义中, override 确保该函数为虚函数并覆写来自基类的虚函数。位置:函数调用运算符之后,函数体或纯虚函数标识 “= 0” 之前。 使用以后有以下好处:1.可以当注释用,方便阅读.2.告诉阅读你代码的人,这是方法的复写.3.编译器可以给你验证 override 对应的方法名是否是你父类中所有的,如果没有...