Im using Hyper/J to propose new aspect-oriented implementations for the GoF Object-oriented design patterns.
I noticed that every time I try to define a new constructor for a specific class -with the same signature- in order to compose it with the original class's constructor, the override general strategy (or the Override relationship) will not produce a composed constructor which only invokes the newly defined constructor. Although, in reality, the composed operation results on a merge integration of the two constructors- in the sense described for mergeByName or merge relationships- even the composition rule is override.
Furthermore, even I defined a new constructor-with a different signature, the newly defined constructor in the composed class is merged as well to the original class's constructor (even the composition rules don't merge them).
I want to no if it is possible to override a classs constructor by defining a new constructor with the same signature? And if the fact that the constructors are merged is done systematically for a certain reason that I ignore?
My example is :
package basePackage;
public class Context() {
public Context() {System.out.println(basePackage.Context: new Context());}
public void interface(){}
}
strategyPackage;
public class Context() {
private int strategy=0;
public Context(int strategy_fromUser) {
System.out.println(strategyPackage.Context: new Context());
strategy=strategy_fromUser;}
In my single control file (.opt) I only specify the general integration relationship which is the overrideByName: when I invoke my <init>(int) the result is :
basePackage.Context: new Context()
strategyPackage.Context: new Context()
Is this logic???