class Logs
{
public:
static Logs getInstance(); // If Logs is NULL, create new instance and return it, if not return already created instance.
void init(char *pLogsLocation, char *pFileName); // Set the location and file name where the logs should be set.
void writeLog(char *pMessage); // Write a message to the log
~Logs() // Destructor
private:
Logs(); // Constructor
static Logs myLogs;
char logsLocation[128], fileName[128];
}
|
void main()
{
Logs myLogs = Logs::getInstance()
myLogs.init("c:\\logs", "logfile.txt");
MyClass myClass;
myClass.init();
}
class MyClass
{
public:
init()
{
myLogs = Logs::getInstance();
myLogs.init("bla", "bla"); // Should this be done?
}
private:
Logs myLogs;
}
|
