Implementing a data access object template

I would like to implement a data access object template in C ++, but preferably without using multiple inheritance and / or enhancement (which my client does not like).

Do you have any suggestions?

+3
source share
3 answers

OTL (otl.sourceforge.net) is an excellent C ++ database library. This is a single include file, therefore it does not have all the complexity (right or wrong!) With Boost.

In terms of the DAO itself, you have many options. The simplest one that hides the database implementation is simply to use C ++ style interfaces and implement the data access level in a particular implementation.

class MyDAO {
  // Pure virtual functions to access the data itself
}

class MyDAOImpl : public MyDAO {
  // Implementations to get the data from the database
}
+5

Google 10 , . , . , , - factory .

, , Java, Java, ++, .

, factory.

+3

- .

+1

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