V
V
Vadim Gilka2017-03-26 13:21:23
OOP
Vadim Gilka, 2017-03-26 13:21:23

What are the advantages and disadvantages of abstraction in object oriented programming?

I would like to know the advantages and disadvantages of this method, since not one book from which I read this is not described.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hufawoso, 2017-03-26
@hufawoso

Advantages: the application becomes more flexible, you can easily change the part you like.
Disadvantages: code becomes harder to understand

M
Maxim Kudryavtsev, 2017-03-26
@kumaxim

Take the entity telephone and the action call.
How it should look like for the client code:

Phone phone = new CellPhone();
phone->call('number');

Now imagine that different users have different phones:
Each of these phones can ring and ring, but dialing is done differently on each of them. From the position of the client, you should not care, the main thing for you is that there is a phone that rings. You, as a client, abstract from the details, i.e. should you move your finger over the sensor, press the buttons, etc. You shouldn't be concerned about it.
I hope I explained it intelligibly)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question