I have the below code in my C# program:

namespace test
{        
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string val = "0";    
            parent o1 = new parent();               
        }
    }

    public class parent
    {
        string test1()
        {
            string val = "2";
            return val;
        }
    }

    public class child:parent
    {
        string test1()
        {
            string val = "3";
            return val;
        }
    }
}

How to access the method test of class parent? I tried by creating object of parent but unable to access the method. what's wrong in my code?

Related posts

Recent Viewed