❔ picking the right patterns

class Human{
  public int age { /*custom get n set*/ }
}

Human h = new Human();
h.age++;

vs

class Human{
  public int age { get; protected set; }
  public grow() { age++; }
}

Human h = new Human();
h.grow();
Was this page helpful?