namespace abc{
class MyClass{
protected:
tm structTime;
public:
const tm& getTM(){
return structTime;
}
void foo(){ std::string tmp = asctime ( this->getTM() ); }
};
The above code gives me this error:
error: cannot convert 'const tm' to 'const tm*' for argument '1' to 'char* asctime(const tm*)'
I then changed the code to this:
std::string tmp = asctime ( static_cast<const tm*>(getTM()) );
but that gives me an error that says:
invalid static_cast from type 'const tm' to type 'const tm*'
How can I make a 'const tm*' from a 'const tm&'?