北京代孕███(微信:13802269370)███████代孕包男孩,供卵代孕,三代试管婴儿选性别,供卵试管婴儿,十年老品牌代孕公司,
控制台程序的入口点是Main()方法,而你的程序中,并没有对Main()方法进行任何操作,我对你的程序做了如下的修改
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Person p = new Person();//实例化Person类
p.SetName("百度");//调用SetName()方法,并传递参数
p.SetAge(100);//调用SetAge()方法,并传递参数
p.Display();//调用Display()方法,用于显示结果
}
}
class Person
{
private string name = "张三";
private int age = 12;
public void Display()
{
Console.WriteLine("姓名:{0},年龄:{1}", name, age);
}
public void SetName(string PersonName)
{
name = PersonName;
}
public void SetAge(int PersonAge)
{
age = PersonAge;
}
}
}
运行结果如下: