using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication23
{
class DML
{
protected int a, b;
public DML(int x, int y)
{
a = x;
b = y;
}
public virtual int add()
{
return a + b;
}
}
class DML1:DML
{
public DML1(int m,int n)
:base(m,n)
{ }
public override int add()
{
return a + b + 5;
}
}
}
private void button1_Click_1(object sender, EventArgs e)
{
DML o = new DML(10,15);
textBox1.Text = o.add().ToString();
}
out put
-------------------------
25
-------------------------
private void button1_Click_1(object sender, EventArgs e)
{
DML o = new DML1(10,15);
textBox1.Text = o.add().ToString();
}
out put
-------------------------
30
-------------------------
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication23
{
class DML
{
protected int a, b;
public DML(int x, int y)
{
a = x;
b = y;
}
public virtual int add()
{
return a + b;
}
}
class DML1:DML
{
public DML1(int m,int n)
:base(m,n)
{ }
public override int add()
{
return a + b + 5;
}
}
}
private void button1_Click_1(object sender, EventArgs e)
{
DML o = new DML(10,15);
textBox1.Text = o.add().ToString();
}
out put
-------------------------
25
-------------------------
private void button1_Click_1(object sender, EventArgs e)
{
DML o = new DML1(10,15);
textBox1.Text = o.add().ToString();
}
out put
-------------------------
30
-------------------------
No comments:
Post a Comment