重写ToString__方法

 1     class Program
 2     {
 3         static void Main(string[] args)
 4         {
 5             Person p = new Person();
 6             Console.WriteLine(p.ToString());
 7             Console.ReadKey();
 8         }
 9     }
10 
11     public class Person
12     {
13         public override string ToString()
14         {
15             return "Hello World";
16         }
17     }

 

posted @ 2020-09-22 13:32  技术不够脸来凑  阅读(145)  评论(0)    收藏  举报