Thursday, 8 December 2011

implementing same name funtion in Interface


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace
{
WindowsFormsApplication1
public partial class Form1 : Form
{

{
InitializeComponent();
}
public Form1()
public interface aa
{
int sum(int a,int b);
}
public interface bb
{
int sum(int a, int b);
}
class xx : aa,bb
{
int aa.sum(int a, int b)
{
return a + b;

int bb.sum(int a, int b)
{
return a - b;
}
}
}
private void button1_Click(object sender, EventArgs e)

{
xx obj = new xx();
aa a = obj;
bb b = obj;
int p= a.sum(1, 2);
int k = b.sum(4, 2);
MessageBox.Show(p.ToString());
MessageBox.Show(k.ToString());
}

No comments:

Post a Comment