using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 方法未实现时抛异常
{
class Program
{
static void Main(string[] args)
{
Person zhangS = new Person();
zhangS.Eat();
Console.ReadKey();
}
}
class Person
{
//属性
public int Age { get; set; }
//方法,方法未实现
public void Eat()
{
//方法未实现,抛出异常
throw new NotImplementedException();
}
}
}
throw new NotImplementedException(); 方法未实现时在方法内添加,抛出异常方便下次知道
最新推荐文章于 2022-07-10 22:57:23 发布