// stock.h
#ifndef STOCK_H
#define STOCK_H
// declare Stock Class
class Stock
{
private:
string StockExchange;
string Symbol;
string Company;
double Price;
int Shares;
public:
Stock();
Stock(string stockExchange, string symbol, string company, double price, int shares);
void displayStockInfo();
void setStockInfo(string stockExchange, string symbol, string company, double price, int shares);
double getValue();
bool operator < (Stock & aStock);
bool Stock::operator > (Stock & aStock);
};
#endif
//main.cpp
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
#include "stock.h"
using std::string;
using std::endl;
using std::cout;
using std::setw;
using std::ifstream;
// *******************************
// Stock class
Stock::Stock() {
StockExchange = "";
Symbol = "";
Company = "";
Price = 0.0;
Shares = 0;
}
Stock::Stock(string stockExchange, string symbol, string company, double price, int shares) {
StockExchange = stockExchange;
Symbol = symbol;
Company = company;
Price = price;
Shares = shares;
}
// end Stock class
// *******************************
...
我的错误说沿着“没有重载函数股票的实例线::股票(字符串股票交易所,串符号,串公司,双重价格,INT股)存在的东西“。
我在做什么错?我在我的头文件中看到它。
“我的错误说...”说哪里?通常会在通话时报告类似的错误。我在您提供的代码中看不到任何呼叫。 – AnT 2011-04-29 17:53:20
将代码和实际错误消息发布到编译器报告错误的行。 – 2011-04-29 17:54:12
将您的代码缩减为演示错误所需的最小示例,然后重新发布整个结果。 – NPE 2011-04-29 17:54:43