[ create a new paste ] login | about

Link: http://codepad.org/68O4dTXM    [ raw code | output | fork ]

C++, pasted on Jul 16:
#include <iostream>
#include <string>
using namespace std;

class CBaseLogger
{
public:	
	CBaseLogger(){};
	virtual ~CBaseLogger(){};
	void Log(char* pFormat, ...){};
	
};

class CDerivateLogger : public CBaseLogger
{
public:
	bool m_bEnable;
	CDerivateLogger(bool bEnable)
	{
		m_bEnable = bEnable;
	}
	~CDerivateLogger(){};
	
	void Log(char* pFormat, ...)
	{
		if (!m_bEnable)
			return;
			
		CBaseLogger::Log(pFormat);	// ??
	}
	
};

int main() {
	// your code goes here
	
	CDerivateLogger logger(true);
	string str = "Test time";
	logger.Log("%s %d", str.c_str(), int(1));
	
	return 0;
}


Output:
1
2
3
cc1plus: warnings being treated as errors
In function 'int main()':
Line 39: warning: deprecated conversion from string constant to 'char*''


Create a new paste based on this one


Comments: