mardi 23 février 2016

error: no matching function for call to 'b::b()'

Hi i'm just begin to program in C++ but i have a problem. I try to create a class in an other class but it does not work... :/ Could you help me please ?

this is my main :

#include <iostream>
#include "a.hpp"
#include "b.hpp"

using namespace std;



int main()
{

return 0;
}

and this is my first class a cpp :

#include <iostream>
#include "a.hpp"

using namespace std;

a::a(){} /* The problem is here :error: no matching function for call  
to 'b::b()*/
a::~a(){}

void a::write()
{

cout << "Write a number : " << endl;
cin >> m_number;
}

this is the hpp :

#ifndef A_HPP_INCLUDED
#define A_HPP_INCLUDED

#include "b.hpp"


class a : public b
{
public:
a();
~a();
void write();

protected:
int m_number;
};


#endif // INTERFACE_HPP_INCLUDED

the class b cpp :

#include <iostream>
#include "b.hpp"


using namespace std;
b::b(double c, double d){m_c = c; m_d = d}
b::~b(){}

void b::write1()
{
cout << m_c+m_d<< endl;
}

and the hpp :

#ifndef B_HPP_INCLUDED
#define B_HPP_INCLUDED


class b
{
public:
b(double c, double d);
~b();

Thanks a lot for your help !!! void writed1();

protected:
double m_c;
double m_d;
};


#endif // B_HPP_INCLUDED

Aucun commentaire:

Enregistrer un commentaire