Код: Выделить всё
package example;
public class Farm {
static Cat cat = new Cat();
static Cow cow = new Cow();
static Dog dog = new Dog();
static Fox fox = new Fox();
public static void main(String args[]) {
System.out.println(cat.talk(1));
System.out.println(dog.talk(1));
System.out.println(cow.talk(1));
System.out.println(fox.talk(1));
}
}
< /code>
Fox Class: < /p>
package example;
public class Fox extends Animal{
public String talk(int i) {
return "DING DING!!!";
}
}
< /code>
Мой абстрактный аспект: < /p>
package example;
public abstract aspect MyAspect {
protected abstract pointcut scope();
before() : scope() {
System.out.println("Before");
}
}
< /code>
И, наконец, мой выход: < /p>
MEW
WOOF
MOO
DING DING!!!
< /code>
без "до" до "напечатана перед" ding ding !!! "< /p>
Есть идеи, что я делаю не так?>
Подробнее здесь: https://stackoverflow.com/questions/202 ... th-aop-xml