abstraction and encapsulation in asp.net?
when we write all our application methods and variables in a classes is nothing but data abstract开发者_运维知识库ion and encapsulation. Is it right?
Could be true but depends over your design. An Application is nothing but combination of classes working as units to accomplish task. So every thing is something from a class like method, property etc, in Object Oriented Methodology
Abstraction:
By this feature of object oriented programming it is possible to represent the needed information in program without presenting the details.
Data Encapsulation:
Data Encapsulation is the process of combining data and functions into a single unit called class. By this method one cannot access the data directly. Data is accessible only through the functions present inside the class. Thus Data Encapsulation gave rise to the important concept of data hiding.
reference: what is data abstraction and data encapsulation
It's Encapsulation, but not necessarily Abstraction.
In OO, abstraction typically refers to type abstraction. So, it can be argued that using a class type at all is abstraction, but many would say no you'd have to be using polymorphism or inheritance in some way.
精彩评论