954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

dateType class + increment day function

I am working with a dateType class and need to make a function to show next day and the previous day. I have my function set using const keyword so that it can't be changed by users, but now I can't increase my day. help???

int dateType::nextDay() const
{
getDay();
dDay++;
return dDay;
}
int dateType::previousDay() const
{
getDay();
dDay--;
return dDay;
}
xicestorm
Newbie Poster
1 post since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

Please use code tags to post your code. Enclose your code in code tags.
Also post your entire code so that we can be in a state of answering your questions, dont post half baked snippets.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

Functions can't be edited by users anyway. When a function is const, it means that function can't change anything outside of it, which in your case is dDay. Get rid of the const and it'll work.

andrax
Newbie Poster
14 posts since Feb 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You