RSS Forums RSS
Please support our C advertiser: Programming Forums
Views: 1200 | Replies: 2
Reply
Join Date: Oct 2006
Posts: 1
Reputation: xicestorm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
xicestorm xicestorm is offline Offline
Newbie Poster

Help dateType class + increment day function

  #1  
Oct 11th, 2006
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;
}
Last edited by ~s.o.s~ : Oct 11th, 2006 at 3:20 pm. Reason: Use code tags for posting code
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,054
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 372
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: dateType class + increment day function

  #2  
Oct 11th, 2006
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.
Last edited by ~s.o.s~ : Oct 11th, 2006 at 3:19 pm.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Feb 2006
Location: Illinois
Posts: 14
Reputation: andrax is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
andrax andrax is offline Offline
Newbie Poster

Re: dateType class + increment day function

  #3  
Oct 11th, 2006
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:04 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC