Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 02-22-2005, 09:04 PM   #1
Member (6 bit)
 
Join Date: Oct 2004
Posts: 38
Need some help with a code

Well after starting programing and reading all kind of tuts off the websites. I found a pretty cool one to do.. Well after writing it all out and compiling it i found a error and trying to fix it.. And i tryed everything but still couldnt fix it.. So i was hoping one of you programers that know a lot might be able to help me.

Code:
 //Listing 20.2 static data members
  #include 
  
  class Cat
  {
  pubic:
      cat (int age = 1):itsAge(age){HowManyCats++; }
      Virtual ~Cat()  { HowManyCats--; }
      Virtua; int GetAge() { return itsAge; }
      Virtual void SetAge(int age) { itsAge = age; }
      static int GetHowMany() { return HowManyCats; }
  private:
      int itsAge;
      static int HowManyCats;
  };
  
  int Cat::HowManyCats = 0;
  
  void TelepathicFunction();
  
  int main()
  {
      const int MaxCats = 5;
      cat *CatHouse[MaxCats];
      int i;
      for (i = 0; i
Well on line six here is what error i get
Quote:
Line 6 staticfunction.cpp syntax error before `:' token

Last edited by Josh2k4; 02-22-2005 at 09:06 PM.
Josh2k4 is offline   Reply With Quote
Old 02-22-2005, 09:20 PM   #2
Member (9 bit)
 
colecifer's Avatar
 
Join Date: Jan 2004
Location: Kansas City(westwood), KS
Posts: 458
I'm not sure what language this is, c++? I do java myself but they are pretty similiar. In line 6 it says "pubic:" is it suppoused to be "public:" public would be the keyword in java but it might be different here. But its a syntax error so its something like a mispelled word or misplaced :
colecifer is offline   Reply With Quote
Old 02-22-2005, 09:31 PM   #3
Member (6 bit)
 
Join Date: Oct 2004
Posts: 38
Im doing C++
Josh2k4 is offline   Reply With Quote
Old 02-22-2005, 09:39 PM   #4
Member (9 bit)
 
colecifer's Avatar
 
Join Date: Jan 2004
Location: Kansas City(westwood), KS
Posts: 458
did you try what i suggested?
colecifer is offline   Reply With Quote
Old 02-22-2005, 09:47 PM   #5
Member (6 bit)
 
Join Date: Oct 2004
Posts: 38
Yep it worked
Josh2k4 is offline   Reply With Quote
Old 02-22-2005, 10:01 PM   #6
Member (9 bit)
 
colecifer's Avatar
 
Join Date: Jan 2004
Location: Kansas City(westwood), KS
Posts: 458
I see you're still a little new, with only 30 posts. Its always good to report back and say what you did and how well it worked. That way the people helping know what happened for future reference and they can help more people, also they will know what your problem is solved.

--- colecifer ---
colecifer is offline   Reply With Quote
Old 02-22-2005, 10:13 PM   #7
Member (6 bit)
 
Join Date: Oct 2004
Posts: 38
Well after i done that i came accross more errors.. ANd my friend helped me.. While looking at the tut it was about cpas and something else.
Josh2k4 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:18 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2