2009年10月8日

摘要: public(C#参考)public 关键字是类型和类型成员的访问修饰符。公共访问是允许的最高访问级别。对访问公共成员没有限制,如下例所示:class SampleClass{ public int x; // No access restrictions.} 示例 在下面的示例中,声明了两个类:Point 和 MainClass。直接从 MainClass 访问 Point 的公共成员 x 和 ... 阅读全文

posted @ 2009-10-08 14:23 Relax Active 阅读(633) 评论(0) 推荐(0)

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Demo10{ public class FatherClass //声明一个基类! { public virtual decimal Caculate() //声明一个有返回值的方法! { return 10M; ... 阅读全文

posted @ 2009-10-08 14:20 Relax Active 阅读(294) 评论(0) 推荐(0)

摘要: Animal的虚方法场景示例://Animal.csusing System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Inherit{ public class Animal //声明一个Animal类! { public virtual void bite() //用关键字vir... 阅读全文

posted @ 2009-10-08 14:19 Relax Active 阅读(112) 评论(0) 推荐(0)

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Inherit{ class Program { public interface Animal //声明一个Animal接口! { void bite(); //声明接口的方法成员! } public class ... 阅读全文

posted @ 2009-10-08 14:18 Relax Active 阅读(124) 评论(0) 推荐(0)


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3