[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

Noob: What is the error in this code?

noemailplease0001

10/7/2008 6:10:00 PM


#ifndef POSITION_H_
#define POSITION_H_

class Position
{
public:
Position(std::string name, std::string name):
m_name( name), m_description(description){}
std::string toString();
private:
std::string m_name;
std::string m_description;

};

#endif /* POSITION_H_ */

I get an error 'error: expected `;' before "m_description"' I don't
understand that.
2 Answers

Rolf Magnus

10/7/2008 6:22:00 PM

0

noemailplease0001@gmail.com wrote:

>
> #ifndef POSITION_H_
> #define POSITION_H_
>
> class Position
> {
> public:
> Position(std::string name, std::string name):

You cannot have two parameters with the same name. And std::string is
undefined here.

> m_name( name), m_description(description){}
> std::string toString();
> private:
> std::string m_name;
> std::string m_description;
>
> };
>
> #endif /* POSITION_H_ */
>
> I get an error 'error: expected `;' before "m_description"' I don't
> understand that.

Where did you get that error?


joseph cook

10/8/2008 12:20:00 AM

0

On Oct 7, 2:10 pm, noemailplease0...@gmail.com wrote:
> #ifndef POSITION_H_
> #define POSITION_H_

You don't have any include files, and as such, "std::string" is not
defined.

Here is the list of standard C++ headers
http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.vacpp7a.doc/standlib/ref/std...

Joe C