Object-oriented programming’s primary tenets are to prevent outsiders to gain unauthorized access to data. It accomplishes that by encapsulating data. OOP hides the variables within a class, and that helps in implementing the security apps. Because OOP enables the management of states and sections of code. OOP forces modularity and creates safety for methods. The methods process object instances and act as state access points. As a result, sensitive data remains safe and prevent trying to access it for malicious means.
You can watch this video on Functional Programming and OOP to understand more: