首页 > 代码库 > 子类调用父类的事件

子类调用父类的事件

    class Father
    {
        public event HCDLL.DGTransString OnEvent;
        protected void SendEvent(string msg)
        {
            if (OnEvent != null)
            {
                OnEvent(msg);
            }
        }
    }

    class Son : Father
    {
        public Son()
        {
            SendEvent("This is a Test");
        }
    }

子类调用父类的事件