Skip to content

Instantly share code, notes, and snippets.

@nanwang2016
Last active July 22, 2020 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanwang2016/4b073f921ac21c495d0ba84cd5decf94 to your computer and use it in GitHub Desktop.
Save nanwang2016/4b073f921ac21c495d0ba84cd5decf94 to your computer and use it in GitHub Desktop.
using System;
namespace TestFile
{
class Program
{
static void Main(string[] args)
{
Student UniStudent = new Student("Peter", "Home");
//Complier will issue an error say,
UniStudent.Address = "Home2";
}
}
class Student
{
private string name;
private string address;
public Student(string name, string address)
{
this.name = name;
this.address = address;
}
public string Name
{
get
{
return name;
}
}
public string Address
{
get
{
return address;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment