What is abstraction?The process of hiding unnecessary data and exposing essential features is called abstraction. Abstraction is separating the logical properties from implementation details.
What is an abstraction and why is it important?- Abstraction is to specify what to do (the necessary details) but not how to do (all details). For example, monitor information like size, screen type, power switches are specified for abstraction. But the inner parts and the functionality need not be known. In other words, making the details available for the user does matters.
- For example, Employee class has a method calculateSalary() which receives the ‘empid’ as parameter and returns the salary of the employee concerned. The user who invokes the calculateSalary() method does not concerned about how the salary calculated. So, abstraction specifies to expose only the details which are concerned with the user.
- Abstraction is important because, the code reusability is one of the benefits to the user. There is flexibility to implement the business logic for various objects which accesses the method. In the above example, salaries of employees of various cadres can use the neither same method with minor nor changes.
What is abstraction?It is the process of hiding unwanted details from the user.