Stanfillirenfro
1st February 2013, 18:58
Hello!
I am facing a difficult problem now. I would be grateful if you could help me.
I have created a function in a class and I want to use the same function in another class. The problem is that when I am calling this function, I have a message error like this: " no match for 'operator=' in 'variable3 = ...'"
In my code, I have created an instance of the class A. From the class B (in a function (g)), I am calling the function (f) of the class A. I want to use variable3 for further purposes.
Could you tell me please where the matter is?
Many thanks in advance.
Here is my code:
class header files.
class A
{public:
double f(double);
}
#include "A.h"
class B
{public:
double g(A &file, double);
}
class cpp files
#include "A.h"
double A::f(double variable1)
{
// do stuff on variable1
}
#include "A.h"
#include "B.h"
double B::g(A &file, double variable2)
{
double variable3;
variable3 = file.f(variable2);
}
I am facing a difficult problem now. I would be grateful if you could help me.
I have created a function in a class and I want to use the same function in another class. The problem is that when I am calling this function, I have a message error like this: " no match for 'operator=' in 'variable3 = ...'"
In my code, I have created an instance of the class A. From the class B (in a function (g)), I am calling the function (f) of the class A. I want to use variable3 for further purposes.
Could you tell me please where the matter is?
Many thanks in advance.
Here is my code:
class header files.
class A
{public:
double f(double);
}
#include "A.h"
class B
{public:
double g(A &file, double);
}
class cpp files
#include "A.h"
double A::f(double variable1)
{
// do stuff on variable1
}
#include "A.h"
#include "B.h"
double B::g(A &file, double variable2)
{
double variable3;
variable3 = file.f(variable2);
}