Interface IWorkPerson
{
public string FirstName {get; set;}
public string LastName { get; set; }
public string WorkPhone { get; set; }
}
interface IHomePerson
{
public string FirstName {get; set;}
public string LastName { get; set; }
public string HomePhone { get; set; }
}
public class Person : IWorkPerson, IHomePerson
{
public string FirstName {get; set;}
public string LastName { get; set; }
public string WorkPhone { get; set; }
public string HomePhone { get; set; }
}
How can I make the Person class implement IWorkPerson and IHomePerson in C#?
The compiler complains about ambiguous references.
Compiles fine w/VS2010 under .Net 2.0, 3.0, 3.5 or 4.0 once you strip out the ‘public’ modifiers from your interface declarations. What version of Visual Studio are you using (or are you using Mono?) and what version of the .Net framework are you targeting?
This code compiles absolutely clean: