Given:
<code>
public class DAOManager {
public AccountDAO getAccountDAO() {
return new AccountJDBCDAO();
}
}
</code>
Which design pattern best describes the class?
A.
Singleton
B.
DAO
C.
Factory
D.
Composition
Explanation:
Data Access Object
Abstracts and encapsulates all access to a data source Manages the connection to the data source to obtain and store data Makes the code independent of the data sources and data vendors (e.g. plain-text, xml, LDAP, MySQL, Oracle, DB2)
C
+1
This seems like a Factory to me. Letter C.