It happens because
GetTime
method gets its parameter
by value
, hence a temporary object is created (and then destroyed when such method terminates).
Change
GetTime
signature (updated as per
Philippe Mori suggestion)
(prototype in class)
static void GetTime(const MyTime & t);
(implementation)
void MyTime::GetTime(const MyTime & t)
{
}
if you don't like such a behaviour.