tags:

views:

93

answers:

2
string str = "";
for ( int x = 0; x < str.length(); x++ );
+2  A: 

Those date constructors look wrong. Neither of the no-args or copy constructors actually initialize any of the fields.

Jim Lewis
Can I make it do that somehow?
Do i need to have the ':' to intialize in the dates ctor init list?
It's preferable to use `:`, though you can also just assign the fields in constructor body.
Pavel Minaev
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
+7  A: 
asveikau
Yes, that was the problem. Stupid me and the stupid stale ptr. Thank you so much! <konk>
Then why not accept the answer?
Bill