Maha

Maha

  • NA
  • 600
  • 70.9k

Interface

Mar 25 2015 3:05 PM
It is said that public modifier is used to access a class from outside.

public void IA1.Foo1() method is not accessible from the main method. But
void IA1.Foo1() method is accessible from the main method. Please tell me reason. Problem is highlighted. 

using System;

interface IA1
{
void Foo1();
}

class CA : IA1
{
public void IA1.Foo1()
{
Console.WriteLine("In Foo2 of CA");
}
}

class Program
{
static void Main(string[] args)
{
IA1 a1; CA a;
a = new CA();
a1 = new CA();

a1.Foo1();

Console.ReadKey();
}
}


Answers (5)