Best explained my the small snippet - below. Here we have two classes Math
and SolveEquation
. They both rely on each other. Is it conventional practice ? or an Anti-pattern that should be avoided at all costs ?
Note : please refrain alternate solutions. This example was tailor made to answer the doubt I have. Thanks.
Eg:
class SolveEquation {
public static int solveEquation(int x, int y) {
return Math.add(x, y) + Math.sub(x, y);
}
}
class Math {
public static int solveEquation(int x, int y) {
return SolveEquation.solveEquation(x, y);
}
public static int add(int x, int y) {
return x + y;
}
public static int sub(int x, int y) {
return x - y;
}
}