member initialisation list won't work

I'm having an annoying problem and it's one that is just really eating at me because when I try to intialise a string variable through a member initialisation list I just get errors I tried doing it without the initialisation list and it works perfect yet when I use it just produces an error could anybody tell me where I have gone wrong?

Thanks


people.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  #ifndef PEOPLE_H
#define PEOPLE_H
#include <string>

using namespace std;


class people
{
    public:

        people(string n);

    private:

        string name;
};

#endif // PEOPLE_H 



people.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


#include "people.h"
#include "birthday.h"
#include <iostream>
#include <string>

using namespace std;

people::people()
: name(n)
{

}




here is the error

||=== Build: Debug in comp4 (compiler: GNU GCC Compiler) ===|
\Documents\comp4\src\people.cpp|8|error: prototype for 'people::people()' does not match any in class 'people'|
include\people.h|8|error: candidates are: people::people(people&&)|
include\people.h|8|error: people::people(const people&)|
include\people.h|12|error: people::people(std::string)|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Last edited on
> error: prototype for 'people::people()' does not match
> people::people(std::string)
1
2
3
4
5
people::people(string n)
: name(n)
{

}
Thanks ne555

I totally forgot you had to include the variable in the signature
Topic archived. No new replies allowed.