Need to have more understanding about the private variables and inheritance. Earlier my understanding was if there is field in a class and when I\'m inheriting the class, th
private variables / members are not inherited. That's the only answer.
Providing public accessor methods is the way encapsulation works. You make your data private and provide methods to get or set their values, so that the access can be controlled.