| | |
Class declaration syntax error
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 7
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
#include <string.h> class ITEM //here i get the error { private: int price; char name[ 21 ]; int efatr[ 4 ]; public: void setName( char* newname ); void setPrice( int newprice ); void setAtribut( int x, int ef ); ITEM() { name = "Player"; price = 0; } ~ITEM(); char* getName(); int getPrice(); ITEM_atribut getAtribut(); } void ITEM::setName( char* newname ) { strcpy( name, newname ); } void ITEM::setPrice( int newprice ) { price = newprice; }
i get a declaration syntax error at the class
Whats the problem??
•
•
Join Date: Nov 2008
Posts: 7
Reputation:
Solved Threads: 0
now its even worse
C++ Syntax (Toggle Plain Text)
#include <string.h> class ITEM // declaration sytax error { private: int price; char name[ 21 ]; int efatr[ 4 ]; public: void setName( char* newname ); void setPrice( int newprice ); void setAtribut( int x, int ef ); ITEM() { strcpy( name, "Player" ); price = 0; } ~ITEM(); char* getName(); int getPrice(); int getAtribut( int x ); }; void ITEM::setName( char* newname ) // "declaration syntax errror " and "size of 'ITEM' is unknown or zero" { strcpy( name, newname ); } void ITEM::setPrice( int newprice ) { price = newprice; } char* ITEM::getName() { return name; } int ITEM:: getPrice() { return price; } int ITEM::getAtribut(int x) { return efatr[x]; } void ITEM::setAtribut( int x, int ef ) { efatr[ x ] = ef; }
C++ Syntax (Toggle Plain Text)
// what's this ITEM_atribut getAtribut();
Last edited by cikara21; Nov 24th, 2008 at 1:56 pm.
![]() |
Similar Threads
- Unknown syntax error in C++ class (C++)
- missing storage-class or type specifiers error (C++)
- [c++/visual studio 2003]Array Declaration Issue (C++)
- Need help with some syntax errors (C++)
- Compiling a Class in several parts?!? (C++)
- String declaration in class definition (C)
- I cant correct these two errors (C++)
- Error message help? (C++)
- DECLARATION SYNTAX ERROR (for bc 31 user) (C++)
Other Threads in the C++ Forum
- Previous Thread: char variables
- Next Thread: Detect a specific frequency tone
Views: 1095 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int integer java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets







...