当我作为C#开发人员工作时,我知道我们可以通过使用Interface实现多重继承.
我想要使用Interface在C#中实现多重继承的代码.
提前致谢.
解决方法
这是一个很好的例子.
interface ICustomerCollection { void Add(string customerName); void Delete(string customerName); } class CustomerCollection : ICustomerCollection { public void Add(string customerName) { /*Customer collection add method specific code*/ } public void Delete(string customerName) { /*Customer collection delete method specific code*/ } } class MyUserControl: UserControl,ICustomerCollection { CustomerCollection _customerCollection=new CustomerCollection(); public void Add(string customerName) { _customerCollection.Add(customerName); } public void Delete(string customerName) { _customerCollection.Add(customerName); } }