I'm still fairly new to inheritance and polymorphism, so forgive me. I'm writing a group of derived classes using Scite editor in Linux, and am receiving a compile error stating that my value constructor implementation doesn't match the prototype in the header file.
powerseller.cpp:9:1: error: prototype for \u2018PowerSeller::PowerSeller(std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string)\u2019 does not match any in class \u2018PowerSeller\u2019 powerseller.h:15:3: error: candidates are: PowerSeller::PowerSeller(const PowerSeller&) powerseller.h:13:3: error: PowerSeller::PowerSeller(std::string, std::string) powerseller.cpp:7:1: error: PowerSeller::PowerSeller()
Here's my header file. The value constructor is the one throwing the error.
#include "seller.h"
#ifndef POWERSELLER_H
#define POWERSELLER_H
using namespace std;
class PowerSeller : public Seller
{
public:
//constructors & destructors
PowerSeller();
PowerSeller(string fName, string lName, string id, string email, string loc, string date, string numOfStars, string numOfItems, string webAddress, string yearItems);
PowerSeller(const PowerSeller& other);
~PowerSeller();
//member functions
void setWebsite(string webAddress);
void setYearItems(string yearItems);
virtual void print();
virtual void read();
//overloaded operators
bool operator ==(const PowerSeller& rhs);
PowerSeller & operator =(const PowerSeller& rhs);
//overloaded ostream
friend ostream & operator <<(ostream& os, const PowerSeller& rhs);
protected:
string website, items;
};
#endif
Here's the implementation
include "powerseller.h"
#include <iostream>
using namespace std;
PowerSeller::PowerSeller(){}
PowerSeller::PowerSeller(string fName, string lName, string id, string email, string loc, string date, string numOfStars, string numOfItems, string webAddress, string yearItems): Seller(fName, lName, id, email, loc, date, numOfStars, numOfItems){
website = webAddress;
items = yearItems;
}
PowerSeller::PowerSeller(const PowerSeller& other):Seller(other){
website= other.website;
items = other.items;
}
PowerSeller::~PowerSeller(){
website = " ";
items = " ";
}
My ultimate question is: Why is the compiler still showing that PowerSeller's value constructor only accepts two string arguments when I've altered it in the file to match the implementation?
Aucun commentaire:
Enregistrer un commentaire