class MathProcess
{
public:
double GetLogValue(double, double);
double GetSineValue(double);
int MultiSumFunc(int,int,int);
private:
int base,value;
double x;
int start,step,upperbound;
};
Hello.I have these codes. How can I add multiplications of two complex numbers in this programme? (create Complex.h class)But they all will be in main.cpp.
for example; (3+4i)*(2+i)=2+11i
These are codes of multiplications of two complex numbers, but I don't know where I must put these codes in this project? Is there anybody who can help me?
Could you post the full program please? I need to be able to see where you want the complex multiplication function- whether you want it under the mathprocess class or perhaps a child class. However, I believe the issue you may be having is the inclusion of the main() proc when you add it to your other code- be sure to get rid of main() {...} from the complex multiplication proc before you add it to your other program, or else it will not work.
In that case, make the class Complex a child class of MathProcess. The second snippet of code that you put for the class Complex is unnecessary- that's just the code to run it. The first part of the code is the class itself, which is what you want to put into MathProcess.
Why should complex be derived from MathProcess? Which of the inherited functions or variables from MathProcess is useful for the complex class?
You already have the code for the * operator in the complex class - why do you need to do any thing differently?
You could just have a class for each type of math process, then create an object of a particular type as required. Then call which ever function is needed.