using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace AI_Logic
{
    class Program
    {
        static void Main(string[] args)
        {
            Test t = new Test();
            t.test();
            Console.Read();
        }
    }    class T
    {
        public void Demo()
        {
            Console.WriteLine("我是基类的Demo方法");
        }
    }    class Test : T
    {
        T t = new T();        public void test()
        {
            T play = (true) ? this : t;// 我原打算在true的时候用当前类的Demo方法,可是现在一直调用的为基类T的Demo,这是什么问题,如何解决呢?
            play.Demo();
        }        public new void Demo()
        {
            Console.WriteLine("我是新的Demo方法");
        }
    }
}
上面控制台程序,复制粘贴就能运行。