Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Polymorphism & Introductions

Unless Line.draw() is public, it's not visible to clients, so try this:
 
public aspect AnAspect {
 public void Line.draw() {...}
}
 
The programming guide explains the meaning of access modifiers for
inter-type declarations: relative to the aspect (not the target), and
"protected" is not allowed. 
 
 
Enjoy -
Wes
 
P.S. - How many people at National University are interested in AspectJ?
 
 
------------Original Message------------
From: "Aamir Raheem" <aamir_raheem@xxxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Sat, Aug-6-2005 7:44 AM
Subject: [aspectj-users] Polymorphism & Introductions
Hi,
 
Consider the following simple program:
 
public class Shape {
 void draw() {
  System.out.println("Shape.draw() called");
 }
}
 
public class Line extends Shape { 
}
 
public aspect AnAspect {
 void Line.draw() {
  System.out.println("Line.draw() called");
 }
}
 
public class Main {
 public static void main(String[] args) {
  Shape s = new Line();
  s.draw();
 }
}
 
The AJDT 1.1.12 for Eclipse 3.0.0 generates following output for the above program:
 
Shape.draw() called
 
I want to know why polymorphism does not work here?
 
Thanks and Regards,
Aamir Raheem,
FAST-NU,
Pakistan.


Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE! _______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Back to the top