Last active
July 22, 2020 13:14
-
-
Save nanwang2016/4b073f921ac21c495d0ba84cd5decf94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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