I have created this interface based on documentation given to me. (I need to work with a third party API for database logging). I am expected to return the object type "Logger" for the getLogger() method and object type "DatabaseMgr" for the getDatabaseMgr method. However, these are abstract classes. The documentation did not specify what the method does, they simply wrote {...}.
If I cannot create an instance of those classes, then how can I return them?
using System;
using System.Data.Common;
namespace com.XXXXXXXXXX.api
{
public class ApiFactory
{
public static ApiFactory getInstance() {
return new ApiFactory();
}
public Logger getLogger(String Id, Type type)
{
}
public DatabaseMgr getDatabaseMgr(String Id)
{
}
}
public abstract class Logger
{
public String Id { get; set; }
public abstract void trace(String message);
public abstract void debug(String message);
public abstract void info(String message);
public abstract void warn(String message);
public abstract void error(String message);
public abstract void alert(String message);
public abstract bool isTraceEnabled { get; }
public abstract bool isDebugEnabled { get; }
public abstract bool isInfoEnabled { get; }
public abstract bool isWarnEnabled { get; }
public abstract bool isErrorEnabled { get; }
}
public abstract class DatabaseMgr
{
public String Id { get; set; }
protected DatabaseMgr(String Id)
{
}
}
}
LoggerandDatabaseMgrrespectively and then return objects of those newly created classes.