Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 639.2k

Problem in c# Program.

Dec 30 2011 1:51 AM
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)