g++ compilor error regard extra qualification?

Hey guys, so I have two files, a .h and a .cpp as such:

//this is shopper.h
#include <iostream>
#include <stdlib.h>
using namespace std;

class Shopper
{
public:

Shopper::Shopper(int yrs_a_mbr, double av_mnth_prchs, char* sh_nm);
int years_a_member;
double avg_month_purchases;
double membership_cost;
double nominal_membership_cost;
private:


};


and the .cpp is :

#include "shopper.h"
#include <iostream>

using namespace std;

Shopper::Shopper(int yrs_a_mbr, double av_mnth_prchs, char* sh_nm)
{

}


now where I compile, it is giving me an error saying there is an extra qualification of Shopper::Shopper in the .h file, what am I doing wrong?
You don't need to scope the class when inside the class declaration. Just remove the Shopper:: that is inside the include file.

Also don't forget to add include guards to your header file. Also at present that header file shouldn't need any #includes. And it is considered a very bad practice to have that using statement in your header file.

Topic archived. No new replies allowed.