Is encapsulation get achieved when we declare all variables of the instance or class private? What if I have to keep some variables of class public and some private? Is it still an encapsulation?
Is it necessary to keep all the variables private for encapsulation? Suppose I have a class "Employee", the variables of the class are Employee_name, Employee_salary, Employee_pincode and the methods of the class include "get Employee_salary", "set Employee_salary", "get Employee_pincode", "set Employee_pincode".I want to keep the Employee_name  as public and Employee_salary, Employee_pincode as private. Is it still an encapsulation? What if I keep all the variables of the class public? Is it an encapsulation? Please clear my confusion. Thanks
In OOP (Object Oriented Programming, of which Encapsulation is one of the Four Pillars), variables are either referred to as fields or properties. Fields are private variables whereas properties are public variables (accessible outside the class).
Is encapsulation get achieved when we declare all variables of the instance or class private?