| 1. |
What is Abstraction and Encapsulation? |
||||||||
Answer»
Abstraction means to show only the necessary details to the client of the object. Abstraction is the process of refining AWAY all the unneeded/unimportant attributes of an object and keep only the characteristics best suitable for your DOMAIN. Abstraction means putting all the variables and methods in a class which are necessary. Encapsulation is a strategy used as part of abstraction. Encapsulation refers to the state of objects - objects encapsulate their state and hide it from the outside; outside users of the class interact with it through its methods, but cannot access the CLASSES state directly. So the class abstracts away the implementation details related to its state. It is a method for PROTECTING data from unwanted access or alteration. Encapsulation is the mechanism by which Abstraction is implemented. Difference between Abstraction and Encapsulation
|
|||||||||