C# Class Basics Tutorial
class student{
int roll;
string name;
string city;
public void setdata(int r, string n, string c)
{
roll = r;
name = n;
city = c;
}
public void show()
{
Console.WriteLine(roll);
Console.WriteLine(name);
Console.WriteLine(city);
}
}
class Program
{
static void Main(string[] args)
{
student ob = new student();
ob.setdata(101, "Amit", "Varanasi");
ob.show();
}
}
No comments:
Post a Comment