View Single Post
Join Date: Nov 2008
Posts: 7
Reputation: Nickyu0712 is an unknown quantity at this point 
Solved Threads: 0
Nickyu0712 Nickyu0712 is offline Offline
Newbie Poster

Re: Class declaration syntax error

 
0
  #3
Nov 24th, 2008
now its even worse
  1. #include <string.h>
  2.  
  3.  
  4. class ITEM // declaration sytax error
  5. {
  6. private:
  7. int price;
  8. char name[ 21 ];
  9. int efatr[ 4 ];
  10. public:
  11. void setName( char* newname );
  12. void setPrice( int newprice );
  13. void setAtribut( int x, int ef );
  14. ITEM()
  15. {
  16. strcpy( name, "Player" );
  17. price = 0;
  18. }
  19. ~ITEM();
  20. char* getName();
  21. int getPrice();
  22. int getAtribut( int x );
  23. };
  24.  
  25.  
  26.  
  27. void ITEM::setName( char* newname ) // "declaration syntax errror " and "size of 'ITEM' is unknown or zero"
  28. {
  29. strcpy( name, newname );
  30. }
  31.  
  32. void ITEM::setPrice( int newprice )
  33. {
  34. price = newprice;
  35. }
  36.  
  37. char* ITEM::getName()
  38. {
  39. return name;
  40. }
  41.  
  42. int ITEM:: getPrice()
  43. {
  44. return price;
  45. }
  46.  
  47. int ITEM::getAtribut(int x)
  48. {
  49. return efatr[x];
  50. }
  51.  
  52. void ITEM::setAtribut( int x, int ef )
  53. {
  54. efatr[ x ] = ef;
  55. }
Reply With Quote