OOP abstraction: multiple but fairly clear contexts?

I am doing some research on the concepts of OOP, and I have a little problem trying to understand what abstraction is. I switched to numerous stack overflow messages on this topic, but could not pinpoint a satisfactory answer.

I saw a lot of discussion about the differences between abstraction and encapsulation, and naturally I started thinking about abstraction in terms of hiding how a particular class works and providing abstraction via the class API. Here are a few posts that drove me in this direction:

However, as I read more posts, I noticed answers depicting abstraction in the context of Inheritance, in particular using interfaces and abstract classes to provide an abstraction of a specific object (class). I suggested that the abstraction given in this way will allow developers to appropriately expand new objects in accordance with the “recommendations” outlined in this abstraction. Here are a few posts that lead me in this direction:

, , , , , . , - , , .

: ? ?

  • " ",

    • , . IPet, Dog. , Animal . , Animal, .
  • API

    • Dog, , feed() API , , . Dog

, , , :

" , , ".

, : P? !

: SO, , " ". , , , SO. , , , , . , , , , , , .

+4
2

- , : , , . : . , : , ( ): , , , .. . , , , , . , : .

: , . , : Asset, Car ( Boat and House), SportCar, FamilyCar. . , , .

, , . . , Car , SportCar , FamilyCar.

, : .

: http://javarevisited.blogspot.be/2017/04/difference-between-abstraction-and-encapsulation-in-java-oop.html

stackoverflow: ?

, .

+1

, - , . , , " , , , ", : " , , , ". .

0

Source: https://habr.com/ru/post/1691560/


All Articles