public class FuckBase { public void FuckSomething(int fuck) { } } public class Fuck :FuckBase, A { public int AInt { get; private set; } public void DoSomething() { } }
public interface A { void DoSomething(); } public interface DeriveedA: A { new void DoSomething(); }
public interface DeriveedA: A { new void DoSomething(); int AInt { get; set; } }
public interface DeriveedA: A { new void DoSomething(); int AInt { get; } } public class Fuck : DeriveedA { public int AInt { get; private set;//固然了这里也能够是protected
} public void DoSomething() { } }
public class Starter { /// <summary>
/// 程序入口点 /// </summary>
/// <param name="args"></param>
public static void Main(string[] args) { Fuck test = new Fuck(); } } public interface IFuck { void Haha(); } public class Fuck :IFuck { void IFuck.Haha() { } }
public class Starter { /// <summary>
/// 程序入口点 /// </summary>
/// <param name="args"></param>
public static void Main(string[] args) { Fuck test = new Fuck(); IFuck interfaceFuck = (IFuck)test; interfaceFuck.Haha();//这个时候至关于可使用test.Haha这个方法了
} } public interface IFuck { void Haha(); } public class Fuck :IFuck { void IFuck.Haha()//注意显式实现接口不能带访问修饰符
{ } }
public class Starter { /// <summary> /// 程序入口点 /// </summary> /// <param name="args"></param> public static void Main(string[] args) { Flys fly = new Flys(); IFlyB flyB = fly; flyB.Cost();//计算航班B的价格 IFlyC flyC = fly; flyC.Cost();//计算航班C的价格 fly.Cost();//计算普通航班的价格 Console.ReadKey(); } }
public interface IFlyB { void Cost(); } public interface IFlyC { void Cost(); } public class Flys :IFlyB,IFlyC { public void Cost() { Console.WriteLine("Other fly"); } void IFlyB.Cost() { Console.WriteLine("Fly B"); } void IFlyC.Cost() { Console.WriteLine("Fly C"); } }
class Flys { public: virtual void cost()const = 0 { std::cout << "Other fly" << std::endl; } }; class FlyB :public Flys { public: void cost()const override { std::cout << "FlyB" << std::endl; } }; class FlyC :public Flys { public: void cost()const override { std::cout << "FlyC" << std::endl; } }; class OtherFly :public Flys { public: void cost()const override { Flys::cost(); } };
public interface IOne { int Item { get; set; } } public interface ITwo { int Item(); } public class Hey : IOne, ITwo { public int Item { get; set;} public int Item() { throw new NotImplementedException(); } }
public interface IOne { int Item { get; set; } } public interface ITwo { int Item(); } public class Hey : IOne, ITwo { public int Item { get; set;} int ITwo.Item() { } }
public class ListNode<T> : IList<T> { public T RemoveAt(int index) { } void IList<T>.RemoveAt(int index) { } }