Skip to content

Instantly share code, notes, and snippets.

@nipunas
Created December 23, 2014 00:49
Show Gist options
  • Save nipunas/8cc4c8dc2c0900aa402b to your computer and use it in GitHub Desktop.
Save nipunas/8cc4c8dc2c0900aa402b to your computer and use it in GitHub Desktop.
Access Modifiers - Protected
class Employee : Person
{
static void Main()
{
Person person = new Person();
//Not allowed
//person.Id = 1;
Employee employee = new Employee();
employee.Id = 2;
}
}
class Person
{
protected int Id { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment