Constructor
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 constructor : Form
{
public constructor()
{
InitializeComponent();
}
struct person
{
public string name;
public string specialization;
public person(string mname, string special)
{
name = mname;
specialization = special;
}
}
private void button1_Click(object sender, EventArgs e)
{
person p = new person("Sunitha", ".net");
MessageBox.Show("I am "+p.name+" specializing in "+p.specialization);
}
}
}
Category: