Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create a class name "CExchangeRate". I got an error when I attempt to create a class name "CExchangeRates" which inherit from CList<cexchangerate,cexchangerate&>.
The error description is: error C2512:'CExchangeRate': no appropriate default constructor available.Who can help me?

Codes of CExchangeRate:
C++
#include <string>
#include <sstream>
using namespace std;

C++
class CExchangeRate
{
public:
    CExchangeRate(string dividendCurrency,string divisorCurrency,double result);
    ~CExchangeRate(void);
    string displayInfo();
private:
    string _dividendCurr;
    string _divisorCurr;
    double _result;
};


Codes of CExchangeRates:
C++
#include <Afxtempl.h>
#include "ExchangeRate.h"
class CExchangeRates : public CList<CExchangeRate,CExchangeRate&>
{
public:
    CExchangeRates(void);
    ~CExchangeRates(void);
};
Posted

1 solution

Add a default constructor to the CExchangeRate class - CExchangeRate(void);
 
Share this answer
 
Comments
Espen Harlinn 30-Jul-11 12:34pm    
Right :)
virusx1984 30-Jul-11 18:39pm    
It works thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900