srinath

srinath

  • NA
  • 144
  • 0

Access Parent class method using child class object

Oct 15 2011 11:55 AM
 Hi,

  I have a scenario as given below.

  Class A
  {
    public void method()
   {
     Console.WriteLine("A");
   }
  }

  Class B :A
  {
    public void method()
   {
     Console.WriteLine("B");
   }
  }

  Here in main method of a class, I create an object for Class B and I want to access method() of Class A.
  i.e B b = new B(); Using this 'b' object I want to access the method() of Class A.
  I am unable to do this please give me the solution

Answers (2)