0

I need your help

I have this piece of code

 interface A
{
      void PrintFields();
}
class B : A
{
    int y;
    void  A.PrintFields()
    {
         Console.WriteLine("y = {0}", y);
    }
}

and I have this

  interface A
{
      void PrintFields();
}
class B : A
{
    int y;
    public void PrintFields()
    {
         Console.WriteLine("y = {0}", y);
    }
}

}

so I am confused about the difference between those two different ways in implementing interface methods and why I can't use the public modifier in the first way.

Mo Haidar
  • 3,748
  • 6
  • 37
  • 76

0 Answers0