I have a simple project with the following files, but could not get it to run.
multiplication.h
class Multiplication{
public:
float multiply(float x, float y);
};
subtraction.h
class Subtraction{
public:
float subtract(float x, float y);
};
multiplication.cpp
#include "multiplication.h"
float Multiplication::multiply(float x, float y){
float prod;
prod = x*y;
return prod;
};
subtraction.cpp
#include "subtraction.h"
float Subtraction::subtract(float x, float y){
float diff;
diff = x-y;
return diff;
};
main.cpp
#include "subtraction.h"
#include "multiplication.h"
#include <iostream>
int main(){
//lets calculate 4*5-20
Multiplication* m = new Multiplication();
Subtraction* s = new Subtraction();
std::cout<<s->subtract(m->multiply(4,5),20);
}
However, I get the following errors when I try to build the project and could not figure out why, would love to get some help:)