Simple Inheritance:
Problem 2:-->
Windowform2: Problem 2:-->
Windowform2:
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;
using simpleinterface;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
simple
obj = new simple();
private
void button1_Click(object
sender, EventArgs e)
{
MessageBox
.Show ( obj.sum(1, 3).ToString ());
//obj.display();
}
private
void button2_Click(object
sender, EventArgs e)
{
obj.display();
}
}
}
Simpleinheritance:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace simpleinterface
{
public interface Imyint
{
void
display();
}
public class simple:Imyint
{
public void display()
{
MessageBox.Show("i am in display");
}
public int sum(int a, int b)
{
return
(a + b);
}
}
}
Posted By:Tanuj Kumar
On:Shareyourconscience
Comments
Post a Comment