I have Java code using interfaces and objects. However I cannot write it with C++. Can you help me about it?
There is an interface named Operation.java Here is the code.
public interface Operation {
int evaluation(int x, int y);
}
There is a class implement Operation class named Multiply.java Here is the code.
public class Multiply implements Operation {
public int eval(int x, int y) {
return = x*y;
}
}
And there is a another class implement Operation class named Summation Here is the code.
public class Add implements Operation {
public int eval(int x, int y) {
return = x+y;
}
And the final, it declares this array.
private static final Operation[] OPERATIONS = {new Multiply(), new Summation()};
In here, I am trying to write this code in C++. However I don't have deep knowledge about C++'s OOP. I understand the Java code totally, but I cannot write in C++. Could you help about it.
Thank you.