public class Person
{
private string name;
private int age;
// Encapsulated methods to access private members
public string GetName()
{
return name;
}
public void SetName(string newName)
{
name = newName;
}
public int GetAge()
{
return age;
}
public void SetAge(int newAge)
{
age = newAge;
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter