I'm getting error, parent' does not contain a definition for 'Print' and no extension method 'Print' accepting a first argument of type 'parent' could be found (are you missing a using directive or an assembly reference?)

    class Program
    {
        public static void Main(string[] args)
        {
            parent p1 = new child();
            p1.Print();
        }
    }
    //Parent Class
    public class parent
    {
    }

    //Child Class
    public class child : parent
    {
        public void Print() { }
    }

Related posts

Recent Viewed