file " :\python programs\class_method py"line in print("total count", __secretcountcannot access private variable directly attributeerror'counterobject has no attribute '__secretcountdata encapsulation and data abstractionwe can restrict access of methods and variables in class with the help of encapsulation it will prevent the data being modified by accident encapsulation is used to hide the value or state of structured data object inside classpreventing unauthorized parties direct access to them data abstraction refers to providing only essential information about the data to the outside worldhiding the background details of implementation encapsulation is process to bind data and functions together into single unit class while abstraction is process in which the data inside the class is the hidden from outside world in short hiding internal details and showing functionality is known as abstraction to support encapsulationdeclare the methods or variables as private in the class the private methods cannot be called by the object directly it can be called only from within the class in which they are defined any function with double underscore is called private method access modifiers for variables and methods arepublic methods variablesaccessible from anywhere inside the classin the sub classin same script file as well as outside the script file