I know how to use the dot notation to call a class variable i.e. var.name = "John" but I have read that this is poor practice for encapsulation.
Does Encapsulation require a constructor followed by getter and setter methods?
krakatoa
but I have read that this is poor practice for encapsulation.
Depends who you ask I reckon. Dot notational access implies leaving the back door open for anyone who wants a cup of sugar. Getter method will pass you the sugar through a hatch.
Sorry, If the class variables are private I mean.
I know how to use the dot notation to call a class variable i.e. var.name = "John" but I have read that this is poor practice for encapsulation.
Does Encapsulation require a constructor followed by getter and setter methods?