Class file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class inheritanc
{
private int
mibalance;
public int balance
{
get
{
return
mibalance;
}
set
{
mibalance = value;
}
}
}
class inher : inheritanc
{
public void deposit(int amt)
{
balance = balance + amt;
}
public void withdraw(int
amt)
{
balance = balance - amt;
}
}
}
Windows form
file
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 inheritance : Form
{
public inheritance()
{
InitializeComponent();
}
private
void inheritance_Load(object
sender, EventArgs e)
{
inheritanc
kk=new inheritanc();
MessageBox.Show(kk.balance.ToString());
}
}
}
No comments:
Post a Comment