This is how we can define a Class in C#.Net Here we code to create a class named Student has three member variables,one constructor and properties such as Name,Age.
Public Class Student
{
private
string name;
private
string id;
private
int age;
public
Student(string name, string
id, int age)
{
this.name = name;
this.id = id;
this.age = age;
}
public string Name
{
get
{ return name; }
}
public
string Id
{
get
{ return id; }
}
public
int Age
{
get
{ return age; }
}
}
Comments
Post a Comment