What types of abstract interfaces are most common in practice
I wasn't completely sure how to phrase what I wanted to ask in the title so I'll try to clarify it better in what follows.
For C++ software library developers, what abstract interfaces do you find yourselves rewriting often between projects/jobs? For instance开发者_如何学C, I would imagine that it is fairly common practice for different projects to write abstract interfaces for "printing" objects and for serializing objects based on the requirements of that project (even if they are implemented in terms of other established libraries which provide a lot of that functionality). What are your experiences with this?
If the question is too vague feel free to recommend how to clarify it.
it depends on what you're developing in some cases. here's a short list:
clone, create (factory method), serialization, threading, mediation, observing.
I don't know if the question is c++ specific. Seems like a general programming question. I find even when I do JS coding I still use the abstract concept.
I think the simplest answer is you use abstract classes whenever you do the same set of operations on different types. The abstract methods fill in the details of that particular implementation, the other methods provide the framework, i.e. the "same set of operations".
As a java developer, it is very common to use the abstract pattern for DAO CRUD operations. Its always the same, the only thing different is the type...
精彩评论