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) { } }