1
Answer

Problem in c# Program.

Smart    Lucky

Smart Lucky

13y
1.6k
1
Hi


 public class A
    {
        protected string Name = "My Value";
        public int ID = 4545;
        public string getName() { return Name; }
        private int g = -5;
    }
    class B : A
    {
       
            A a = new A();
            a.getName(); // Here i Want to call getName Method but it is showing me error can any one help me....
        
    }
    class C {
        protected int z = -34;
    }
    public class MyClass{
        public static void Main()
        {
            A obj = new A();
            Console.WriteLine(obj.getName()); // it is working here correctly 
            //D obj=new D ()
            
        }
    }
    class D : A { 
        
    }
Answers (1)