string str = "";
for ( int x = 0; x < str.length(); x++ );
views:
93answers:
2
+2
A:
Those date constructors look wrong. Neither of the no-args or copy constructors actually initialize any of the fields.
Jim Lewis
2009-10-06 23:30:43
Can I make it do that somehow?
2009-10-06 23:32:19
Do i need to have the ':' to intialize in the dates ctor init list?
2009-10-06 23:34:38
It's preferable to use `:`, though you can also just assign the fields in constructor body.
Pavel Minaev
2009-10-06 23:45:33
I would recommend just removing the copy constructor for date and using the compiler generated copy constructor and assignment operators instead. I'm not sure what the no-args constructor is doing... I would expect something like `date::date() { std::time_t now = std::time(NULL); std::tm local = *std::localtime( day = local.tm_mday; month = local.tm_mon+1; year = local.tm_year+1900; }`
D.Shawley
2009-10-07 00:29:40