当前位置:首页 > Windows程序 > 正文

C#控制台基础 ref,out同时存在不可以重载的实例

2021-03-12 Windows程序

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace ConsoleApplication2 8 { 9 class Program 10 { 11 static void Main(string[] args) 12 { 13 14 } 15 16 public void Hello(ref int a) 17 { 18 Console.WriteLine(); 19 } 20 public void Hello(out int aa) 21 { 22 //必须在离开这个方法前对aa赋值 23 aa = 1; 24 Console.WriteLine(); 25 } 26 } 27 28 }

2、错误提示

技术分享

看到了木,两个方法仅仅在ref 与 out 上不同时,是不算重载的。

标签:

原文地址:

(0)

(0)

   

举报

评论 一句话评论(0

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/59957.html