public class SchoolClass
{
private int school_id;
private string school_name;
public int schoolID
{
get { return school_id; }
set { school_id = value; }
}
public string SchoolName
{
get { return school_name; }
set { school_name = value; }
}
public SchoolClass()
{
school_id = 0;
school_name = string.Empty;
}
public SchoolClass(int id, string n)
{
school_id = id;
school_name = n;
}
}
if code in red is missing then the following error will be displayed when executing the following code:
SchoolClass sc = new SchoolClass() { schoolID = 2, SchoolName = "some name" };
No comments:
Post a Comment