Ctime调用GetCurrentTime()
CTime time; time.GetCurrentTime(); int m_nYear = time.GetYear();
CTime time = CTime::GetCurrentTime(); int m_nYear = time.GetYear();
为什么前者导致程序崩溃?查了MSDN,Creates a CTime object that represents the current time (static member function).
GetCurrentTime()为其静态成成员函数,应该可以通过类作用域符或者对象调用.这个函数用过几次,每次用都习惯性的用了通过对象调用,结果崩溃了,看了写法觉得没错,,结果半天没发现是这里写法出了问题.这回非得问清楚,呵呵...