xiaolizi007
1/4/2017 - 6:49 AM

Throw Vs ThrowEx

Throw Vs ThrowEx #csharp

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Throw
{
    class Program
    {
        static void Main(string[] args)
        {
            SecondChild c = new SecondChild();
            Console.WriteLine(c.GetMethodOwnerName());

            Console.ReadKey();
        }
    }
    public class BaseClass
    {
        public virtual string GetMethodOwnerName()
        {
            return "Base Class";
        }
    }
    public class ChildClass : BaseClass
    {
        public new virtual string GetMethodOwnerName()
        {
            return "ChildClass";
        }
    }
    public class SecondChild : ChildClass
    {
        public override string GetMethodOwnerName()
        {
            return "Second level Child";
        }
    }
}