e心e意

导航

C# 密封类

namespace SEALED
{
/*密封类的目的是防止派生的发生*/
sealed class SealedClass
{
public int add(int x, int y)
{
return x + y;
}
}
class Program
{
static void Main(string[] args)
{
SealedClass sealedcls = new SealedClass();
int total = sealedcls.add(4,5);
Console.WriteLine("Total="+total .ToString ());
}
}
}

posted on 2014-12-04 19:34  e心e意  阅读(88)  评论(0)    收藏  举报